rpms/avidemux/devel avidemux-2.5.4-audio_prefs.patch, 1.1, NONE avidemux-2.5.4-ffmpeg_perms.patch, 1.1, NONE avidemux-2.5.4-gcc46_tmp_fix.patch, 1.1, NONE avidemux-2.5.4-gtk_menu_crash_fix.patch, 1.1, NONE avidemux-2.5.4-x264_fix.patch, 1.2, NONE avidemux_2.5.4-ffmpeg-aac.patch, 1.2, NONE
by Richard Shaw
Author: hobbes1069
Update of /cvs/free/rpms/avidemux/devel
In directory se02.es.rpmfusion.net:/tmp/cvs-serv3809
Removed Files:
avidemux-2.5.4-audio_prefs.patch
avidemux-2.5.4-ffmpeg_perms.patch
avidemux-2.5.4-gcc46_tmp_fix.patch
avidemux-2.5.4-gtk_menu_crash_fix.patch
avidemux-2.5.4-x264_fix.patch avidemux_2.5.4-ffmpeg-aac.patch
Log Message:
Removing old patches.
--- avidemux-2.5.4-audio_prefs.patch DELETED ---
--- avidemux-2.5.4-ffmpeg_perms.patch DELETED ---
--- avidemux-2.5.4-gcc46_tmp_fix.patch DELETED ---
--- avidemux-2.5.4-gtk_menu_crash_fix.patch DELETED ---
--- avidemux-2.5.4-x264_fix.patch DELETED ---
--- avidemux_2.5.4-ffmpeg-aac.patch DELETED ---
13 years, 5 months
rpms/avidemux/devel avidemux-2.5.5-gcc46_tmp_fix.patch, NONE, 1.1 avidemux-2.5.5_fix_lav_audio_encoder.patch, NONE, 1.1 avidemux_2.5.5-ffmpeg_aac.patch, NONE, 1.1 .cvsignore, 1.8, 1.9 avidemux.spec, 1.48, 1.49 sources, 1.8, 1.9
by Richard Shaw
Author: hobbes1069
Update of /cvs/free/rpms/avidemux/devel
In directory se02.es.rpmfusion.net:/tmp/cvs-serv32714
Modified Files:
.cvsignore avidemux.spec sources
Added Files:
avidemux-2.5.5-gcc46_tmp_fix.patch
avidemux-2.5.5_fix_lav_audio_encoder.patch
avidemux_2.5.5-ffmpeg_aac.patch
Log Message:
* Sun Jun 05 2011 Richard Shaw <hobbes1069(a)gmail.com> - 2.5.5-1
- New release: 2.5.5
- FFMpeg based AAC encoding is broken (BZ#1825) and
will be disabled until fixed.
avidemux-2.5.5-gcc46_tmp_fix.patch:
avidemux/ADM_UIs/ADM_QT4/src/T_configMenu.cpp | 11 +++-------
avidemux/ADM_UIs/ADM_QT4/src/T_configMenu.h | 2 -
plugins/ADM_videoEncoder/ADM_vidEnc_x264/qt4/x264ConfigDialog.cpp | 8 ++-----
plugins/ADM_videoEncoder/ADM_vidEnc_x264/qt4/x264ConfigDialog.h | 2 -
plugins/ADM_videoEncoder/ADM_vidEnc_xvid/qt4/xvidConfigDialog.cpp | 8 ++-----
plugins/ADM_videoEncoder/ADM_vidEnc_xvid/qt4/xvidConfigDialog.h | 2 -
6 files changed, 13 insertions(+), 20 deletions(-)
--- NEW FILE avidemux-2.5.5-gcc46_tmp_fix.patch ---
diff -Naur avidemux_2.5.5.orig/avidemux/ADM_UIs/ADM_QT4/src/T_configMenu.cpp avidemux_2.5.5/avidemux/ADM_UIs/ADM_QT4/src/T_configMenu.cpp
--- avidemux_2.5.5.orig/avidemux/ADM_UIs/ADM_QT4/src/T_configMenu.cpp 2011-04-23 14:56:47.000000000 -0500
+++ avidemux_2.5.5/avidemux/ADM_UIs/ADM_QT4/src/T_configMenu.cpp 2011-06-06 08:36:43.093745534 -0500
@@ -138,7 +138,7 @@
*configType = (ConfigMenuType)combobox->itemData(combobox->currentIndex()).toInt();
}
- bool ADM_QconfigMenu::selectConfiguration(QString *selectFile, ConfigMenuType configurationType)
+ bool ADM_QconfigMenu::selectConfiguration(const QString &selectFile, ConfigMenuType configurationType)
{
bool success = false;
bool origDisableGenericSlots = disableGenericSlots;
@@ -210,8 +210,7 @@
delete [] configData;
fillConfigurationComboBox();
- QString qs=QFileInfo(configFileName).completeBaseName();
- selectConfiguration(&qs, CONFIG_MENU_USER);
+ selectConfiguration(QFileInfo(configFileName).completeBaseName(), CONFIG_MENU_USER);
}
}
}
@@ -316,8 +315,7 @@
void diaElemConfigMenu::updateMe(void)
{
ADM_QconfigMenu *configMenu = (ADM_QconfigMenu*)myWidget;
- QString qs=QString(configName);
- configMenu->selectConfiguration(&qs, *configType);
+ configMenu->selectConfiguration(QString(configName), *configType);
}
void diaElemConfigMenu::finalize(void)
@@ -356,8 +354,7 @@
while (parentWidget != NULL);
}
}
- QString qs=QString(configName);
- configMenu->selectConfiguration(&(qs), *configType);
+ configMenu->selectConfiguration(QString(configName), *configType);
}
}
diff -Naur avidemux_2.5.5.orig/avidemux/ADM_UIs/ADM_QT4/src/T_configMenu.h avidemux_2.5.5/avidemux/ADM_UIs/ADM_QT4/src/T_configMenu.h
--- avidemux_2.5.5.orig/avidemux/ADM_UIs/ADM_QT4/src/T_configMenu.h 2009-07-30 13:38:30.000000000 -0500
+++ avidemux_2.5.5/avidemux/ADM_UIs/ADM_QT4/src/T_configMenu.h 2011-06-06 08:30:50.336250102 -0500
@@ -46,7 +46,7 @@
~ADM_QconfigMenu();
void getConfiguration(char *configName, ConfigMenuType *configType);
- bool selectConfiguration(QString *selectFile, ConfigMenuType configurationType);
+ bool selectConfiguration(const QString &selectFile, ConfigMenuType configurationType);
};
}
#endif // T_configMenu_h
diff -Naur avidemux_2.5.5.orig/plugins/ADM_videoEncoder/ADM_vidEnc_x264/qt4/x264ConfigDialog.cpp avidemux_2.5.5/plugins/ADM_videoEncoder/ADM_vidEnc_x264/qt4/x264ConfigDialog.cpp
--- avidemux_2.5.5.orig/plugins/ADM_videoEncoder/ADM_vidEnc_x264/qt4/x264ConfigDialog.cpp 2011-04-23 14:56:49.000000000 -0500
+++ avidemux_2.5.5/plugins/ADM_videoEncoder/ADM_vidEnc_x264/qt4/x264ConfigDialog.cpp 2011-06-06 08:44:49.739870167 -0500
@@ -216,7 +216,7 @@
disableGenericSlots = origDisableGenericSlots;
}
-bool x264ConfigDialog::selectConfiguration(QString *selectFile, PluginConfigType configurationType)
+bool x264ConfigDialog::selectConfiguration(const QString &selectFile, PluginConfigType configurationType)
{
bool success = false;
bool origDisableGenericSlots = disableGenericSlots;
@@ -350,8 +350,7 @@
delete [] xml;
fillConfigurationComboBox();
- QString qs=QFileInfo(configFileName).completeBaseName();
- selectConfiguration(&qs, PLUGIN_CONFIG_USER);
+ selectConfiguration(QFileInfo(configFileName).completeBaseName(), PLUGIN_CONFIG_USER);
}
delete [] configDirectory;
@@ -587,8 +586,7 @@
disableGenericSlots = true;
options->getPresetConfiguration(&configurationName, &configurationType);
- QString qs=QString(configurationName);
- bool foundConfig = selectConfiguration(&qs, configurationType);
+ bool foundConfig = selectConfiguration(QString(configurationName), configurationType);
if (!foundConfig)
printf("Configuration %s (type %d) could not be found. Using snapshot.\n", configurationName, configurationType);
diff -Naur avidemux_2.5.5.orig/plugins/ADM_videoEncoder/ADM_vidEnc_x264/qt4/x264ConfigDialog.h avidemux_2.5.5/plugins/ADM_videoEncoder/ADM_vidEnc_x264/qt4/x264ConfigDialog.h
--- avidemux_2.5.5.orig/plugins/ADM_videoEncoder/ADM_vidEnc_x264/qt4/x264ConfigDialog.h 2010-09-29 15:20:48.000000000 -0500
+++ avidemux_2.5.5/plugins/ADM_videoEncoder/ADM_vidEnc_x264/qt4/x264ConfigDialog.h 2011-06-06 08:30:50.339250103 -0500
@@ -46,7 +46,7 @@
uint8_t intra8x8Luma[64], inter8x8Luma[64];
void fillConfigurationComboBox(void);
- bool selectConfiguration(QString *selectFile, PluginConfigType configurationType);
+ bool selectConfiguration(const QString &selectFile, PluginConfigType configurationType);
bool loadPresetSettings(vidEncOptions *encodeOptions, x264Options *options);
void loadSettings(vidEncOptions *encodeOptions, x264Options *options);
int getValueIndexInArray(uint8_t value, const uint8_t valueArray[], int elementCount);
diff -Naur avidemux_2.5.5.orig/plugins/ADM_videoEncoder/ADM_vidEnc_xvid/qt4/xvidConfigDialog.cpp avidemux_2.5.5/plugins/ADM_videoEncoder/ADM_vidEnc_xvid/qt4/xvidConfigDialog.cpp
--- avidemux_2.5.5.orig/plugins/ADM_videoEncoder/ADM_vidEnc_xvid/qt4/xvidConfigDialog.cpp 2011-04-30 07:49:07.000000000 -0500
+++ avidemux_2.5.5/plugins/ADM_videoEncoder/ADM_vidEnc_xvid/qt4/xvidConfigDialog.cpp 2011-06-06 08:41:31.901324879 -0500
@@ -129,7 +129,7 @@
disableGenericSlots = origDisableGenericSlots;
}
-bool XvidConfigDialog::selectConfiguration(QString *selectFile, PluginConfigType configurationType)
+bool XvidConfigDialog::selectConfiguration(const QString &selectFile, PluginConfigType configurationType)
{
bool success = false;
bool origDisableGenericSlots = disableGenericSlots;
@@ -234,8 +234,7 @@
fillConfigurationComboBox();
- QString qs=QFileInfo(configFileName).completeBaseName();
- selectConfiguration(&qs, PLUGIN_CONFIG_USER);
+ selectConfiguration(QFileInfo(configFileName).completeBaseName(), PLUGIN_CONFIG_USER);
}
delete [] configDirectory;
@@ -375,8 +374,7 @@
disableGenericSlots = true;
options->getPresetConfiguration(&configurationName, &configurationType);
- QString qs=QString(configurationName);
- bool foundConfig = selectConfiguration(&qs, configurationType);
+ bool foundConfig = selectConfiguration(QString(configurationName), configurationType);
if (!foundConfig)
printf("Configuration %s (type %d) could not be found. Using snapshot.\n", configurationName, configurationType);
diff -Naur avidemux_2.5.5.orig/plugins/ADM_videoEncoder/ADM_vidEnc_xvid/qt4/xvidConfigDialog.h avidemux_2.5.5/plugins/ADM_videoEncoder/ADM_vidEnc_xvid/qt4/xvidConfigDialog.h
--- avidemux_2.5.5.orig/plugins/ADM_videoEncoder/ADM_vidEnc_xvid/qt4/xvidConfigDialog.h 2009-08-03 11:24:09.000000000 -0500
+++ avidemux_2.5.5/plugins/ADM_videoEncoder/ADM_vidEnc_xvid/qt4/xvidConfigDialog.h 2011-06-06 08:30:50.341250092 -0500
@@ -26,7 +26,7 @@
unsigned char intraMatrix[64], interMatrix[64];
void fillConfigurationComboBox(void);
- bool selectConfiguration(QString *selectFile, PluginConfigType configurationType);
+ bool selectConfiguration(const QString &selectFile, PluginConfigType configurationType);
bool loadPresetSettings(vidEncOptions *encodeOptions, XvidOptions *options);
void loadSettings(vidEncOptions *encodeOptions, XvidOptions *options);
avidemux-2.5.5_fix_lav_audio_encoder.patch:
audioencoder_lavcodec.cpp | 2 ++
1 file changed, 2 insertions(+)
--- NEW FILE avidemux-2.5.5_fix_lav_audio_encoder.patch ---
diff --git a/plugins/ADM_audioEncoders/lavcodec/audioencoder_lavcodec.cpp b/plugins/ADM_audioEncoders/lavcodec/audioencoder_lavcodec.cpp
index be265c1..39f14e6 100644
--- a/plugins/ADM_audioEncoders/lavcodec/audioencoder_lavcodec.cpp
+++ b/plugins/ADM_audioEncoders/lavcodec/audioencoder_lavcodec.cpp
@@ -144,6 +144,8 @@ uint8_t AUDMEncoder_Lavcodec::initialize(void)
CONTEXT->channels = _wavheader->channels;
CONTEXT->sample_rate = _wavheader->frequency;
CONTEXT->bit_rate = (lavConfig.bitrate*1000); // bits -> kbits
+ CONTEXT->sample_fmt=AV_SAMPLE_FMT_S16;
+ CONTEXT->request_sample_fmt=AV_SAMPLE_FMT_S16;
AVCodec *codec;
CodecID codecID;
avidemux_2.5.5-ffmpeg_aac.patch:
avidemux_2.5.4/plugins/ADM_audioEncoders/lavcodec/CMakeLists.txt | 9 ++++
avidemux_2.5.4/plugins/ADM_audioEncoders/lavcodec/audioencoder_lavcodec.cpp | 21 +++++++---
avidemux_2.5.5/cmake/admFFmpegBuild.cmake | 2
3 files changed, 26 insertions(+), 6 deletions(-)
--- NEW FILE avidemux_2.5.5-ffmpeg_aac.patch ---
diff -ur avidemux_2.5.4/plugins/ADM_audioEncoders/lavcodec/audioencoder_lavcodec.cpp avidemux_2.5.4-ffmpeg-aac/plugins/ADM_audioEncoders/lavcodec/audioencoder_lavcodec.cpp
--- avidemux_2.5.4/plugins/ADM_audioEncoders/lavcodec/audioencoder_lavcodec.cpp.ffmpegaac 2010-05-25 16:48:57.000000000 -0400
+++ avidemux_2.5.4/plugins/ADM_audioEncoders/lavcodec/audioencoder_lavcodec.cpp 2010-11-20 16:26:36.756237795 -0500
@@ -25,13 +25,16 @@
#include "ADM_lavcodec.h"
#define Join(x,y) x##_##y
-#if defined(ADM_LAV_MP2) && !defined(ADM_LAV_AC3)
+#if defined(ADM_LAV_MP2) && !defined(ADM_LAV_AC3) && !defined(ADM_LAV_AAC)
#define makeName(x) Join(x,MP2)
#define AUDMEncoder_Lavcodec AUDMEncoder_Lavcodec_MP2
#else
- #if !defined(ADM_LAV_MP2) && defined(ADM_LAV_AC3)
+ #if !defined(ADM_LAV_MP2) && defined(ADM_LAV_AC3) && !defined(ADM_LAV_AAC)
#define makeName(x) Join(x,AC3)
#define AUDMEncoder_Lavcodec AUDMEncoder_Lavcodec_AC3
+ #elif !defined(ADM_LAV_MP2) && !defined(ADM_LAV_AC3) && defined(ADM_LAV_AAC)
+ #define makeName(x) Join(x,AAC)
+ #define AUDMEncoder_Lavcodec AUDMEncoder_Lavcodec_AAC
#else
#error
#endif
@@ -60,13 +63,19 @@
2, // Max channels
1,0,0, // Version
#else
-
-
+#ifdef ADM_LAV_AC3
"LavAC3",
"AC3 (lav)",
"AC3 LavEncoder encoder plugin Mean 2008",
6, // Max channels
1,0,0, // Version
+#else
+ "LavAAC",
+ "AAC (lav)",
+ "AAC LavEncoder encoder plugin Mean 2008",
+ 6, // Max channels
+ 1,0,0, // Version
+#endif
#endif
makeName(WAV),
@@ -132,7 +141,9 @@
#endif
_wavheader->byterate=(lavConfig.bitrate*1000)>>3;
-#ifdef ADM_LAV_MP2
+#if defined(ADM_LAV_AAC)
+ _chunk = 1024*_wavheader->channels;
+#elif defined(ADM_LAV_MP2)
_chunk = 1152*_wavheader->channels;
#else
_chunk = 1536*_wavheader->channels; // AC3
diff -ur avidemux_2.5.4/plugins/ADM_audioEncoders/lavcodec/CMakeLists.txt avidemux_2.5.4-ffmpeg-aac/plugins/ADM_audioEncoders/lavcodec/CMakeLists.txt
--- avidemux_2.5.4/plugins/ADM_audioEncoders/lavcodec/CMakeLists.txt.ffmpegaac 2010-05-25 16:48:57.000000000 -0400
+++ avidemux_2.5.4/plugins/ADM_audioEncoders/lavcodec/CMakeLists.txt 2010-11-20 16:24:10.171164293 -0500
@@ -27,3 +27,12 @@
INIT_AUDIO_ENCODER(ADM_ae_lav_ac3)
INSTALL_AUDIOENCODER(ADM_ae_lav_ac3)
+
+ SET(ADM_ae_lav_aac_SRCS audioencoder_lavcodec.cpp)
+
+ ADD_LIBRARY(ADM_ae_lav_aac SHARED ${ADM_ae_lav_aac_SRCS})
+ ADD_TARGET_CFLAGS(ADM_ae_lav_aac "-DADM_LAV_AAC")
+ TARGET_LINK_LIBRARIES(ADM_ae_lav_aac ADM_core ADM_coreAudio ADM_coreUI ADM_libavcodec ADM_libavutil)
+
+ INIT_AUDIO_ENCODER(ADM_ae_lav_aac)
+ INSTALL_AUDIOENCODER(ADM_ae_lav_aac)
diff -Naur avidemux_2.5.5.orig/cmake/admFFmpegBuild.cmake avidemux_2.5.5/cmake/admFFmpegBuild.cmake
--- avidemux_2.5.5.orig/cmake/admFFmpegBuild.cmake 2011-05-11 12:54:15.000000000 -0500
+++ avidemux_2.5.5/cmake/admFFmpegBuild.cmake 2011-06-05 11:37:00.054112231 -0500
@@ -14,7 +14,7 @@
set(FFMPEG_DECODERS adpcm_ima_amv amv bmp cinepak cyuv dca dvbsub dvvideo ffv1 ffvhuff flac flv fraps h263 h264 huffyuv
mjpeg mjpegb mpeg2video mpeg4 msmpeg4v2 msmpeg4v3 msvideo1 nellymoser png qdm2 rawvideo snow svq3
theora tscc vc1 vp3 vp6 vp6a vp6f wmav2 wmv1 wmv2 wmv3)
-set(FFMPEG_ENCODERS ac3 ac3_fixed ac3_float dvvideo ffv1 ffvhuff flv h263 huffyuv mjpeg mp2 mpeg1video mpeg2video mpeg4 snow)
+set(FFMPEG_ENCODERS aac ac3 ac3_fixed ac3_float dvvideo ffv1 ffvhuff flv h263 huffyuv mjpeg mp2 mpeg1video mpeg2video mpeg4 snow)
set(FFMPEG_MUXERS flv matroska mpeg1vcd mpeg2dvd mpeg2svcd mpegts mov mp4 psp)
set(FFMPEG_PARSERS ac3 h263 h264 mpeg4video)
set(FFMPEG_PROTOCOLS file)
Index: .cvsignore
===================================================================
RCS file: /cvs/free/rpms/avidemux/devel/.cvsignore,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- .cvsignore 19 Apr 2011 23:50:00 -0000 1.8
+++ .cvsignore 27 Jun 2011 14:09:09 -0000 1.9
@@ -1,2 +1 @@
-avidemux_2.5.3.tar.gz
-avidemux.spec.old
+avidemux_2.5.5.tar.gz
Index: avidemux.spec
===================================================================
RCS file: /cvs/free/rpms/avidemux/devel/avidemux.spec,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- avidemux.spec 4 Jun 2011 12:33:21 -0000 1.48
+++ avidemux.spec 27 Jun 2011 14:09:09 -0000 1.49
@@ -1,8 +1,8 @@
%define _pkgbuilddir %{_builddir}/%{name}_%{version}
Name: avidemux
-Version: 2.5.4
-Release: 9%{?dist}
+Version: 2.5.5
+Release: 1%{?dist}
Summary: Graphical video editing and transcoding tool
Group: Applications/Multimedia
@@ -38,18 +38,16 @@
Patch4: avidemux-2.5.3-mpeg2enc.patch
Patch5: avidemux-2.5.3-pluginlibs.patch
# Patch8 obtained from http://lists.rpmfusion.org/pipermail/rpmfusion-developers/2010-October/00...
-Patch6: avidemux_2.5.4-ffmpeg-aac.patch
-Patch7: avidemux-2.5.4-gcc46_tmp_fix.patch
-Patch8: avidemux-2.5.4-gtk_menu_crash_fix.patch
+#Patch6: avidemux_2.5.4-ffmpeg-aac.patch
+Patch6: avidemux_2.5.5-ffmpeg_aac.patch
+Patch7: avidemux-2.5.5-gcc46_tmp_fix.patch
# Patch needed for version of x264 in F15/rawhide.
-Patch9: avidemux-2.5.4-x264_fix.patch
-Patch10: avidemux-2.5.4-audio_prefs.patch
-Patch11: avidemux-2.5.4-ffmpeg_perms.patch
# Use system libraries
-Patch12: avidemux-2.5.4-libass.patch
-Patch13: avidemux-2.5.4-liba52.patch
-Patch14: avidemux-2.5.4-libmad.patch
-Patch15: avidemux-2.5.4-libtwolame.patch
+Patch8: avidemux-2.5.4-libass.patch
+Patch9: avidemux-2.5.4-liba52.patch
+Patch10: avidemux-2.5.4-libmad.patch
+Patch11: avidemux-2.5.4-libtwolame.patch
+Patch12: avidemux-2.5.5_fix_lav_audio_encoder.patch
# Uses a header file not found in the standard package
#Patch16: avidemux-2.5.4-mpeg2enc.patch
@@ -179,7 +177,9 @@
%setup -q -n avidemux_%{version}
# Remove unneeded external libraries
-#rm -rf avidemux/ADM_libraries/ADM_smjs
+%if 0%{?fedora} <= 15
+rm -rf avidemux/ADM_libraries/ADM_smjs
+%endif
rm -rf plugins/ADM_videoFilters/Ass/ADM_libAss
rm -rf plugins/ADM_audioEncoders/twolame/ADM_libtwolame
rm -rf plugins/ADM_audioDecoders/ADM_ad_mad/ADM_libMad
@@ -192,7 +192,7 @@
sed -i.bak 's/startDir="lib";/startDir="lib64";/' avidemux/main.cpp
%endif
-# Fix build with version of js introduced in F15.
+# Fix build with js 1.8.5 introduced in F15.
#find avidemux/ADM_script -name '*.h' -exec \
#sed -i -e '/#include "jsapi.h"/ i\
##undef malloc \
@@ -206,24 +206,25 @@
%patch3 -p1 -b .tmplinktarget
%patch4 -p1 -b .mpeg2enc
%patch5 -p1 -b .pluginlibs
-%patch6 -p1 -b .ffmpegaac
+#%patch6 -p1 -b .ffmpegaac
%patch7 -p1 -b .gcc46tmpfix
-%patch8 -b .gtk_menu
-%patch9 -p1 -b .x264fix
-%patch10 -p1 -b .audioprefs
-%patch11 -p1 -b .ffmpegperms
-%patch12 -p1 -b .libass
-%patch13 -p1 -b .liba52
-%patch14 -p1 -b .libmad
-%patch15 -p1 -b .libtwolame
-#%patch16 -p1 -b .mpeg2enc
+%patch8 -p1 -b .libass
+%patch9 -p1 -b .liba52
+%patch10 -p1 -b .libmad
+%patch11 -p1 -b .libtwolame
+%patch12 -p1 -b .lavencode
%build
# Cmake requires out of source build
mkdir -p build && pushd build
+%if 0%{?fedora} <= 15
+%cmake -DUSE_SYSTEM_SPIDERMONKEY:BOOL=ON \
+%else
%cmake -DUSE_SYSTEM_SPIDERMONKEY:BOOL=OFF \
+%endif
..
+
make %{?_smp_mflags}
# Create the temp link directory manually since otherwise it happens too early
mkdir -p %{_pkgbuilddir}/build/%{_lib}
@@ -320,6 +321,11 @@
%{_includedir}/ADM_coreConfig.h
%changelog
+* Sun Jun 05 2011 Richard Shaw <hobbes1069(a)gmail.com> - 2.5.5-1
+- New release: 2.5.5
+- FFMpeg based AAC encoding is broken (BZ#1825) and
+ will be disabled until fixed.
+
* Sat Jun 04 2011 Richard Shaw <hobbes1069(a)gmail.com> - 2.5.4-9
- New version of js in Fedora 15 breaks build.
- Re-enable built-in javascript for Fedora 15.
Index: sources
===================================================================
RCS file: /cvs/free/rpms/avidemux/devel/sources,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- sources 16 Apr 2011 23:33:22 -0000 1.8
+++ sources 27 Jun 2011 14:09:10 -0000 1.9
@@ -1 +1 @@
-b849460f6480df92bfd72d1a3dc288d4 avidemux_2.5.4.tar.gz
+33bbe210c6826cea1987ed18a41d57a7 avidemux_2.5.5.tar.gz
13 years, 5 months
rpms/transcode/devel transcode-1.1.5-fix_v4l_1.patch, NONE, 1.1 transcode.spec, 1.26, 1.27
by Nicolas Chauvet
Author: kwizart
Update of /cvs/free/rpms/transcode/devel
In directory se02.es.rpmfusion.net:/tmp/cvs-serv18123/devel
Modified Files:
transcode.spec
Added Files:
transcode-1.1.5-fix_v4l_1.patch
Log Message:
Fix rfbz#1824
transcode-1.1.5-fix_v4l_1.patch:
probe_v4l.c | 2 +-
v4l/import_v4l.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--- NEW FILE transcode-1.1.5-fix_v4l_1.patch ---
--- transcode-1.1.5/import/v4l/import_v4l.c 2009-02-21 23:01:57.000000000 +0200
+++ transcode-1.1.5/import/v4l/import_v4l.c.fix_v4l_1 2011-06-26 20:09:32.039709334 +0200
@@ -29,7 +29,7 @@
#include <sys/ioctl.h>
#include <sys/mman.h>
-#include <linux/videodev.h>
+#include <libv4l1-videodev.h>
#define MOD_NAME "import_v4l.so"
#define MOD_VERSION "v0.2.0 (2008-10-26)"
--- transcode-1.1.5/import/probe_v4l.c 2011-06-26 20:22:27.898708862 +0200
+++ transcode-1.1.5/import/probe_v4l.c.fix_v4l_1 2011-06-26 20:21:48.066708886 +0200
@@ -31,7 +31,7 @@
#include <sys/ioctl.h>
-#include <linux/videodev.h>
+#include <libv4l1-videodev.h>
#if defined(HAVE_LINUX_VIDEODEV2_H) && defined(HAVE_STRUCT_V4L2_BUFFER)
#define _LINUX_TIME_H
Index: transcode.spec
===================================================================
RCS file: /cvs/free/rpms/transcode/devel/transcode.spec,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- transcode.spec 21 Apr 2011 20:25:47 -0000 1.26
+++ transcode.spec 26 Jun 2011 20:10:56 -0000 1.27
@@ -7,7 +7,7 @@
Name: transcode
Version: 1.1.5
-Release: 6%{?dist}
+Release: 7%{?dist}
Summary: Video stream processing tool
Group: Applications/Multimedia
@@ -17,9 +17,9 @@
Patch0: %{name}-pvmbin.patch
Patch3: transcode-1.0.4.external_dv.patch
Patch4: transcode-1.1.5-fix_v4l.patch
-Patch5: transcode-1.1.5-no_video.patch
+Patch5: transcode-1.1.5-no_video.patch
Patch6: transcode-1.1.5-videodev2.patch
-
+Patch7: transcode-1.1.5-fix_v4l_1.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -77,6 +77,7 @@
%patch4 -p1 -b .fix_v4l
%patch5 -p1 -b .no_video
%patch6 -p1 -b .videodev2
+%patch7 -p1 -b .fix_v4l_1
rm filter/preview/dv_types.h
rm import/v4l/videodev.h
@@ -122,6 +123,7 @@
--enable-nuv \
%endif
--enable-deprecated \
+ --enable-v4l \
--enable-libv4l2 \
--enable-libv4lconvert \
--enable-libmpeg2 \
@@ -153,6 +155,9 @@
%changelog
+* Sun Jun 26 2011 Nicolas Chauvet <kwizart(a)gmail.com> - 1.1.5-7
+- Fix support for v4l - rfbz#1824
+
* Wed Apr 20 2011 David Juran <david(a)juran.se> - 1.1.5-6
- Disable v4l, Bz 1700
13 years, 5 months
rpms/transcode/F-15 transcode-1.1.5-fix_v4l_1.patch, NONE, 1.1 transcode.spec, 1.26, 1.27
by Nicolas Chauvet
Author: kwizart
Update of /cvs/free/rpms/transcode/F-15
In directory se02.es.rpmfusion.net:/tmp/cvs-serv18123/F-15
Modified Files:
transcode.spec
Added Files:
transcode-1.1.5-fix_v4l_1.patch
Log Message:
Fix rfbz#1824
transcode-1.1.5-fix_v4l_1.patch:
probe_v4l.c | 2 +-
v4l/import_v4l.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--- NEW FILE transcode-1.1.5-fix_v4l_1.patch ---
--- transcode-1.1.5/import/v4l/import_v4l.c 2009-02-21 23:01:57.000000000 +0200
+++ transcode-1.1.5/import/v4l/import_v4l.c.fix_v4l_1 2011-06-26 20:09:32.039709334 +0200
@@ -29,7 +29,7 @@
#include <sys/ioctl.h>
#include <sys/mman.h>
-#include <linux/videodev.h>
+#include <libv4l1-videodev.h>
#define MOD_NAME "import_v4l.so"
#define MOD_VERSION "v0.2.0 (2008-10-26)"
--- transcode-1.1.5/import/probe_v4l.c 2011-06-26 20:22:27.898708862 +0200
+++ transcode-1.1.5/import/probe_v4l.c.fix_v4l_1 2011-06-26 20:21:48.066708886 +0200
@@ -31,7 +31,7 @@
#include <sys/ioctl.h>
-#include <linux/videodev.h>
+#include <libv4l1-videodev.h>
#if defined(HAVE_LINUX_VIDEODEV2_H) && defined(HAVE_STRUCT_V4L2_BUFFER)
#define _LINUX_TIME_H
Index: transcode.spec
===================================================================
RCS file: /cvs/free/rpms/transcode/F-15/transcode.spec,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- transcode.spec 21 Apr 2011 20:25:47 -0000 1.26
+++ transcode.spec 26 Jun 2011 20:10:56 -0000 1.27
@@ -7,7 +7,7 @@
Name: transcode
Version: 1.1.5
-Release: 6%{?dist}
+Release: 7%{?dist}
Summary: Video stream processing tool
Group: Applications/Multimedia
@@ -17,9 +17,9 @@
Patch0: %{name}-pvmbin.patch
Patch3: transcode-1.0.4.external_dv.patch
Patch4: transcode-1.1.5-fix_v4l.patch
-Patch5: transcode-1.1.5-no_video.patch
+Patch5: transcode-1.1.5-no_video.patch
Patch6: transcode-1.1.5-videodev2.patch
-
+Patch7: transcode-1.1.5-fix_v4l_1.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -77,6 +77,7 @@
%patch4 -p1 -b .fix_v4l
%patch5 -p1 -b .no_video
%patch6 -p1 -b .videodev2
+%patch7 -p1 -b .fix_v4l_1
rm filter/preview/dv_types.h
rm import/v4l/videodev.h
@@ -122,6 +123,7 @@
--enable-nuv \
%endif
--enable-deprecated \
+ --enable-v4l \
--enable-libv4l2 \
--enable-libv4lconvert \
--enable-libmpeg2 \
@@ -153,6 +155,9 @@
%changelog
+* Sun Jun 26 2011 Nicolas Chauvet <kwizart(a)gmail.com> - 1.1.5-7
+- Fix support for v4l - rfbz#1824
+
* Wed Apr 20 2011 David Juran <david(a)juran.se> - 1.1.5-6
- Disable v4l, Bz 1700
13 years, 5 months
rpms/xroar/F-15 .cvsignore, 1.5, 1.6 sources, 1.5, 1.6 xroar.spec, 1.6, 1.7 xroar-0.23-info.patch, 1.1, NONE
by Andrea Musuruane
Author: musuruan
Update of /cvs/free/rpms/xroar/F-15
In directory se02.es.rpmfusion.net:/tmp/cvs-serv6604
Modified Files:
.cvsignore sources xroar.spec
Removed Files:
xroar-0.23-info.patch
Log Message:
* Sat Jun 25 2011 Andrea Musuruane <musuruan(a)gmail.com> 0.25.3-1
- Upgrade to 0.25.3
- Dropped JACK dependency now that pulseaudio is supported
Index: .cvsignore
===================================================================
RCS file: /cvs/free/rpms/xroar/F-15/.cvsignore,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- .cvsignore 12 Sep 2010 10:21:23 -0000 1.5
+++ .cvsignore 25 Jun 2011 16:05:27 -0000 1.6
@@ -1,2 +1,2 @@
-xroar-0.24.tar.gz
+xroar-0.25.3.tar.gz
dragon.rom
Index: sources
===================================================================
RCS file: /cvs/free/rpms/xroar/F-15/sources,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- sources 12 Sep 2010 10:21:23 -0000 1.5
+++ sources 25 Jun 2011 16:05:27 -0000 1.6
@@ -1,2 +1,2 @@
-2ed30f4ec8ef2c2e54ef25f7f8d95ce6 xroar-0.24.tar.gz
+488e1eebeb34292d01ec891581184bf4 xroar-0.25.3.tar.gz
f8b5f52c07abb4dc9102d8420605d7e4 dragon.rom
Index: xroar.spec
===================================================================
RCS file: /cvs/free/rpms/xroar/F-15/xroar.spec,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- xroar.spec 14 Oct 2010 22:05:20 -0000 1.6
+++ xroar.spec 25 Jun 2011 16:05:27 -0000 1.7
@@ -1,24 +1,21 @@
Name: xroar
-Version: 0.24
-Release: 2%{?dist}
+Version: 0.25.3
+Release: 1%{?dist}
Summary: A Dragon 32, Dragon 64 and Tandy CoCo emulator
Group: Applications/Emulators
License: GPLv2+
URL: http://www.6809.org.uk/dragon/xroar.shtml
Source0: http://www.6809.org.uk/dragon/%{name}-%{version}.tar.gz
Source1: http://www.6809.org.uk/dragon/dragon.rom
-# Andrea Musuruane
-Patch0: %{name}-0.23-info.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gtk2-devel
-BuildRequires: ImageMagick
-BuildRequires: jack-audio-connection-kit-devel
-BuildRequires: libGLU-devel
-BuildRequires: libsndfile-devel
-BuildRequires: pkgconfig
+BuildRequires: gtkglext-devel
BuildRequires: SDL_image-devel
-BuildRequires: ncurses-devel
+BuildRequires: libsndfile-devel
+BuildRequires: pulseaudio-libs-devel
BuildRequires: texinfo
+BuildRequires: texinfo-tex
+BuildRequires: ImageMagick
BuildRequires: desktop-file-utils
Requires: hicolor-icon-theme
Requires(post): info
@@ -38,18 +35,15 @@
%prep
%setup -q
-# Fix info dir entry
-%patch0 -p1
-
%build
%configure
-make %{?_smp_mflags}
+make %{?_smp_mflags} VERBOSE=1
# Build docs
-make doc/xroar.info
make doc/xroar.txt
make doc/xroar.html
+make doc/xroar.pdf
# Create icon
convert gp32/icon.bmp -transparent '#000000' %{name}.png
@@ -138,10 +132,14 @@
%{_datadir}/applications/dribble-%{name}-minifirm.desktop
%{_infodir}/%{name}.info*
%doc ChangeLog COPYING.GPL COPYING.LGPL-2.1 README
-%doc doc/%{name}.txt doc/%{name}.html doc/%{name}-screens.png
+%doc doc/%{name}.txt doc/%{name}.html doc/%{name}.pdf doc/%{name}-screens.png
%changelog
+* Sat Jun 25 2011 Andrea Musuruane <musuruan(a)gmail.com> 0.25.3-1
+- Upgrade to 0.25.3
+- Dropped JACK dependency now that pulseaudio is supported
+
* Fri Oct 15 2010 Nicolas Chauvet <kwizart(a)gmail.com> - 0.24-2
- Rebuilt for gcc bug
--- xroar-0.23-info.patch DELETED ---
13 years, 5 months
rpms/xroar/devel .cvsignore, 1.5, 1.6 sources, 1.5, 1.6 xroar.spec, 1.6, 1.7 xroar-0.23-info.patch, 1.1, NONE
by Andrea Musuruane
Author: musuruan
Update of /cvs/free/rpms/xroar/devel
In directory se02.es.rpmfusion.net:/tmp/cvs-serv6493
Modified Files:
.cvsignore sources xroar.spec
Removed Files:
xroar-0.23-info.patch
Log Message:
* Sat Jun 25 2011 Andrea Musuruane <musuruan(a)gmail.com> 0.25.3-1
- Upgrade to 0.25.3
- Dropped JACK dependency now that pulseaudio is supported
Index: .cvsignore
===================================================================
RCS file: /cvs/free/rpms/xroar/devel/.cvsignore,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- .cvsignore 12 Sep 2010 10:21:23 -0000 1.5
+++ .cvsignore 25 Jun 2011 16:04:59 -0000 1.6
@@ -1,2 +1,2 @@
-xroar-0.24.tar.gz
+xroar-0.25.3.tar.gz
dragon.rom
Index: sources
===================================================================
RCS file: /cvs/free/rpms/xroar/devel/sources,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- sources 12 Sep 2010 10:21:23 -0000 1.5
+++ sources 25 Jun 2011 16:05:00 -0000 1.6
@@ -1,2 +1,2 @@
-2ed30f4ec8ef2c2e54ef25f7f8d95ce6 xroar-0.24.tar.gz
+488e1eebeb34292d01ec891581184bf4 xroar-0.25.3.tar.gz
f8b5f52c07abb4dc9102d8420605d7e4 dragon.rom
Index: xroar.spec
===================================================================
RCS file: /cvs/free/rpms/xroar/devel/xroar.spec,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- xroar.spec 14 Oct 2010 22:05:20 -0000 1.6
+++ xroar.spec 25 Jun 2011 16:05:00 -0000 1.7
@@ -1,24 +1,21 @@
Name: xroar
-Version: 0.24
-Release: 2%{?dist}
+Version: 0.25.3
+Release: 1%{?dist}
Summary: A Dragon 32, Dragon 64 and Tandy CoCo emulator
Group: Applications/Emulators
License: GPLv2+
URL: http://www.6809.org.uk/dragon/xroar.shtml
Source0: http://www.6809.org.uk/dragon/%{name}-%{version}.tar.gz
Source1: http://www.6809.org.uk/dragon/dragon.rom
-# Andrea Musuruane
-Patch0: %{name}-0.23-info.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gtk2-devel
-BuildRequires: ImageMagick
-BuildRequires: jack-audio-connection-kit-devel
-BuildRequires: libGLU-devel
-BuildRequires: libsndfile-devel
-BuildRequires: pkgconfig
+BuildRequires: gtkglext-devel
BuildRequires: SDL_image-devel
-BuildRequires: ncurses-devel
+BuildRequires: libsndfile-devel
+BuildRequires: pulseaudio-libs-devel
BuildRequires: texinfo
+BuildRequires: texinfo-tex
+BuildRequires: ImageMagick
BuildRequires: desktop-file-utils
Requires: hicolor-icon-theme
Requires(post): info
@@ -38,18 +35,15 @@
%prep
%setup -q
-# Fix info dir entry
-%patch0 -p1
-
%build
%configure
-make %{?_smp_mflags}
+make %{?_smp_mflags} VERBOSE=1
# Build docs
-make doc/xroar.info
make doc/xroar.txt
make doc/xroar.html
+make doc/xroar.pdf
# Create icon
convert gp32/icon.bmp -transparent '#000000' %{name}.png
@@ -138,10 +132,14 @@
%{_datadir}/applications/dribble-%{name}-minifirm.desktop
%{_infodir}/%{name}.info*
%doc ChangeLog COPYING.GPL COPYING.LGPL-2.1 README
-%doc doc/%{name}.txt doc/%{name}.html doc/%{name}-screens.png
+%doc doc/%{name}.txt doc/%{name}.html doc/%{name}.pdf doc/%{name}-screens.png
%changelog
+* Sat Jun 25 2011 Andrea Musuruane <musuruan(a)gmail.com> 0.25.3-1
+- Upgrade to 0.25.3
+- Dropped JACK dependency now that pulseaudio is supported
+
* Fri Oct 15 2010 Nicolas Chauvet <kwizart(a)gmail.com> - 0.24-2
- Rebuilt for gcc bug
--- xroar-0.23-info.patch DELETED ---
13 years, 5 months
rpms/ffmpeg/F-15 ffmpeg-snapshot-oldabi.sh, NONE, 1.1 .cvsignore, 1.23, 1.24 ffmpeg.spec, 1.43, 1.44 sources, 1.23, 1.24
by Nicolas Chauvet
Author: kwizart
Update of /cvs/free/rpms/ffmpeg/F-15
In directory se02.es.rpmfusion.net:/tmp/cvs-serv17695/F-15
Modified Files:
.cvsignore ffmpeg.spec sources
Added Files:
ffmpeg-snapshot-oldabi.sh
Log Message:
Update to snaphot before x264 ABI > 115
--- NEW FILE ffmpeg-snapshot-oldabi.sh ---
#!/bin/bash
set -e
tmp=$(mktemp -d)
trap cleanup EXIT
cleanup() {
set +e
[ -z "$tmp" -o ! -d "$tmp" ] || rm -rf "$tmp"
}
unset CDPATH
pwd=$(pwd)
date=$(date +%Y%m%d)
pushd "$tmp"
git clone git://git.videolan.org/ffmpeg.git -b oldabi
cd ffmpeg
git archive --prefix="ffmpeg-oldabi-${date}/" --format=tar oldabi | bzip2 > "$pwd"/ffmpeg-oldabi-${date}.tar.bz2
popd
Index: .cvsignore
===================================================================
RCS file: /cvs/free/rpms/ffmpeg/F-15/.cvsignore,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- .cvsignore 12 Jun 2011 19:28:41 -0000 1.23
+++ .cvsignore 25 Jun 2011 12:09:55 -0000 1.24
@@ -1 +1 @@
-ffmpeg-0.7-rc1.tar.bz2
+ffmpeg-oldabi-20110612.tar.bz2
Index: ffmpeg.spec
===================================================================
RCS file: /cvs/free/rpms/ffmpeg/F-15/ffmpeg.spec,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- ffmpeg.spec 12 Jun 2011 19:28:41 -0000 1.43
+++ ffmpeg.spec 25 Jun 2011 12:09:55 -0000 1.44
@@ -1,13 +1,13 @@
# TODO: add make test to %%check section
%global branch oldabi-
-#global date 20110612
-%global rel rc1
+%global date 20110612
+#global rel rc1
Summary: Digital VCR and streaming server
Name: ffmpeg
Version: 0.7
-Release: 0.1.%{?date}%{?date:git}%{?rel}%{?dist}
+Release: 0.2.%{?date}%{?date:git}%{?rel}%{?dist}
%if 0%{?_with_amr:1}
License: GPLv3+
%else
@@ -20,7 +20,7 @@
%else
Source0: http://ffmpeg.org/releases/ffmpeg-%{version}-%{rel}.tar.bz2
%endif
-Source1: ffmpeg-snapshot.sh
+Source1: ffmpeg-snapshot-oldabi.sh
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: %{name}-libs = %{version}-%{release}
BuildRequires: bzip2-devel
@@ -238,6 +238,9 @@
%changelog
+* Sun Jun 12 2011 Nicolas Chauvet <kwizart(a)gmail.com> - 0.7-0.2.20110612git
+- Update to 20110612git from oldabi branch
+
* Sun Jun 12 2011 Nicolas Chauvet <kwizart(a)gmail.com> - 0.7-0.1.rc1
- Update to 7.0-rc1
- Remove upstreamed patch
Index: sources
===================================================================
RCS file: /cvs/free/rpms/ffmpeg/F-15/sources,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- sources 12 Jun 2011 19:28:41 -0000 1.23
+++ sources 25 Jun 2011 12:09:55 -0000 1.24
@@ -1 +1 @@
-390f5454c985f1321fe1ffa4fc98b5f6 ffmpeg-0.7-rc1.tar.bz2
+881aca23a4e13a7eb3207d98a1e38643 ffmpeg-oldabi-20110612.tar.bz2
13 years, 5 months
rpms/qmmp-plugins-freeworld/devel .cvsignore, 1.12, 1.13 qmmp-plugins-freeworld.spec, 1.16, 1.17 sources, 1.12, 1.13
by Karel Volný
Author: kvolny
Update of /cvs/free/rpms/qmmp-plugins-freeworld/devel
In directory se02.es.rpmfusion.net:/tmp/cvs-serv17136
Modified Files:
.cvsignore qmmp-plugins-freeworld.spec sources
Log Message:
* Fri Jun 24 2011 Karel Volný <kvolny(a)redhat.com> 0.5.1-1
- version bump
Index: .cvsignore
===================================================================
RCS file: /cvs/free/rpms/qmmp-plugins-freeworld/devel/.cvsignore,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- .cvsignore 15 Dec 2010 17:41:01 -0000 1.12
+++ .cvsignore 24 Jun 2011 16:15:56 -0000 1.13
@@ -1 +1 @@
-qmmp-0.4.3.tar.bz2
+qmmp-0.5.1.tar.bz2
Index: qmmp-plugins-freeworld.spec
===================================================================
RCS file: /cvs/free/rpms/qmmp-plugins-freeworld/devel/qmmp-plugins-freeworld.spec,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- qmmp-plugins-freeworld.spec 15 Dec 2010 17:41:01 -0000 1.16
+++ qmmp-plugins-freeworld.spec 24 Jun 2011 16:15:56 -0000 1.17
@@ -1,5 +1,5 @@
Name: qmmp-plugins-freeworld
-Version: 0.4.3
+Version: 0.5.1
Release: 1%{?dist}
Summary: Plugins for qmmp (Qt-based multimedia player)
@@ -56,16 +56,22 @@
-D USE_WAVPACK:BOOL=FALSE \
-D USE_CUE:BOOL=FALSE \
-D USE_CDA:BOOL=FALSE \
+ -D USE_MIDI:BOOL=FALSE \
+ -D USE_GME:BOOL=FALSE \
\
-D USE_ALSA:BOOL=FALSE \
- -D USE_OSS:BOOL=FALSE \
-D USE_JACK:BOOL=FALSE \
+ -D USE_OSS:BOOL=FALSE \
+ -D USE_OSS4:BOOL=FALSE \
-D USE_PULSE:BOOL=FALSE \
-D USE_NULL:BOOL=FALSE \
+ -D USE_WAVEOUT:BOOL=FALSE \
\
-D USE_SRC:BOOL=FALSE \
-D USE_BS2B:BOOL=FALSE \
-D USE_LADSPA:BOOL=FALSE \
+ -D USE_CROSSFADE:BOOL=FALSE \
+ -D USE_STEREO:BOOL=FALSE \
\
-D USE_ANALYZER:BOOL=FALSE \
-D USE_PROJECTM:BOOL=FALSE \
@@ -76,6 +82,7 @@
-D USE_NOTIFIER:BOOL=FALSE \
-D USE_LYRICS:BOOL=FALSE \
-D USE_HAL:BOOL=FALSE \
+ -D USE_UDISKS:BOOL=FALSE \
-D USE_HOTKEY:BOOL=FALSE \
-D USE_FILEOPS:BOOL=FALSE \
-D USE_COVER:BOOL=FALSE \
@@ -123,6 +130,9 @@
%changelog
+* Fri Jun 24 2011 Karel Volný <kvolny(a)redhat.com> 0.5.1-1
+- version bump
+
* Wed Dec 15 2010 Karel Volný <kvolny(a)redhat.com> 0.4.3-1
- version bump
Index: sources
===================================================================
RCS file: /cvs/free/rpms/qmmp-plugins-freeworld/devel/sources,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- sources 15 Dec 2010 17:41:01 -0000 1.12
+++ sources 24 Jun 2011 16:15:56 -0000 1.13
@@ -1 +1 @@
-b79ce55ed8aca31a29360ff828ce1881 qmmp-0.4.3.tar.bz2
+7934c069256bf2fc4ab762ad2683db2f qmmp-0.5.1.tar.bz2
13 years, 5 months
rpms/xmris/F-14 0001-Fix-xm-exiting-with-a-BadFont-error.patch, NONE, 1.1 0002-Fix-timer-signal-handling-under-Linux.patch, NONE, 1.1 0003-Adjust-Imakefile-for-modern-systems.patch, NONE, 1.1 0004-Catch-the-window-being-deleted.patch, NONE, 1.1 0005-Fix-compiling-of-flock-code-under-Linux.patch, NONE, 1.1 0006-Fix-key-presses-getting-lost.patch, NONE, 1.1 0007-Change-key-binding-defaults-to-something-sane.patch, NONE, 1.1 0008-Fix-compiler-warnings.patch, NONE, 1.1 0009-Remove-TRANSPUTER-stuff.patch, NONE,
by jwrdegoede
Author: jwrdegoede
Update of /cvs/free/rpms/xmris/F-14
In directory se02.es.rpmfusion.net:/tmp/cvs-serv21810
Modified Files:
.cvsignore sources
Added Files:
0001-Fix-xm-exiting-with-a-BadFont-error.patch
0002-Fix-timer-signal-handling-under-Linux.patch
0003-Adjust-Imakefile-for-modern-systems.patch
0004-Catch-the-window-being-deleted.patch
0005-Fix-compiling-of-flock-code-under-Linux.patch
0006-Fix-key-presses-getting-lost.patch
0007-Change-key-binding-defaults-to-something-sane.patch
0008-Fix-compiler-warnings.patch
0009-Remove-TRANSPUTER-stuff.patch
0010-Remove-USELOCKFILE-stuff.patch
0011-Remove-seteuid-stuff.patch 0012-Drop-dir-option.patch
0013-Drop-support-for-global-personal-file.patch
0014-Some-renames.patch
0015-Open-score-files-only-once-and-keep-them-open-till-t.patch
0016-Open-the-global-score-file-asap-and-drop-special-rig.patch
0017-Set-class-to-Xmsit-Xmris-depending-on-how-we-re-laun.patch
0018-Install-manpages-into-section-6-rather-then-1.patch
0019-Add-.desktop-files.patch xmris.png xmris.spec xmsit.png
Log Message:
* Sat May 21 2011 Hans de Goede <j.w.r.degoede(a)gmail.com> 4.0.5-2
- Add missing BuildRequires: libXaw-devel groff
- Change font requires to: xorg-x11-fonts-ISO8859-1-75dpi + 100dpi
0001-Fix-xm-exiting-with-a-BadFont-error.patch:
defcom.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- NEW FILE 0001-Fix-xm-exiting-with-a-BadFont-error.patch ---
>From 2e28187cbb718044cd963d7290f2a4611c305a9a Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Mon, 29 Nov 2010 22:34:51 +0100
Subject: [PATCH 01/20] Fix xm* exiting with a BadFont error
---
defcom.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/defcom.c b/defcom.c
index 8f354dd..f8a59b5 100644
--- a/defcom.c
+++ b/defcom.c
@@ -265,7 +265,7 @@ XtResource resources[] =
#endif /* TRANSPUTER */
#endif /* XMRED */
{XtNfont, XtCFont, XtRFont, sizeof(Font),
- XtOffsetOf(DATA, font), XtRImmediate, (XtPointer)FONT_NAME},
+ XtOffsetOf(DATA, font), XtRString, (XtPointer)FONT_NAME},
{XtNreverseVideo, XtCReverseVideo, XtRBoolean, sizeof(Boolean),
XtOffsetOf(DATA, swap), XtRImmediate, (XtPointer)False},
{"monochrome", "Monochrome", XtRBoolean, sizeof(Boolean),
--
1.7.5
0002-Fix-timer-signal-handling-under-Linux.patch:
timer.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
--- NEW FILE 0002-Fix-timer-signal-handling-under-Linux.patch ---
>From 10e609fae72b30ee7763e95f202d3ecad13685e6 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Mon, 29 Nov 2010 23:26:44 +0100
Subject: [PATCH 02/20] Fix timer signal handling under Linux
---
timer.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/timer.c b/timer.c
index 4f56727..c8fa2c1 100644
--- a/timer.c
+++ b/timer.c
@@ -75,7 +75,7 @@
* signal_release returns the block mask to what it was before signal_hold
*/
#ifndef TRANSPUTER
-#ifdef POSIX
+#if defined POSIX || defined linux
# define MASK sigset_t
# define signal_hold(signal, maskp) \
{\
@@ -85,7 +85,11 @@
sigprocmask(SIG_BLOCK, &temp, (maskp)); \
}
# define signal_release(maskp) sigprocmask(SIG_SETMASK, maskp, (MASK *)NULL)
-# define signal_pause(maskp) sigpause(*(maskp))
+# ifdef linux
+# define signal_pause(maskp) sigsuspend(maskp)
+# else
+# define signal_pause(maskp) sigpause(*(maskp))
+# endif
#else
# ifdef __hpux /* hpux is a weird mixture of BSD & SYSV */
/* don't know if this is right */
--
1.7.5
0003-Adjust-Imakefile-for-modern-systems.patch:
Imakefile | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
--- NEW FILE 0003-Adjust-Imakefile-for-modern-systems.patch ---
>From e9da98bfc559f227fe7784f227ff631e2a774c3f Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Mon, 29 Nov 2010 23:18:26 +0100
Subject: [PATCH 03/20] Adjust Imakefile for modern systems
---
Imakefile | 27 ++++++++++++---------------
1 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/Imakefile b/Imakefile
index 43345c6..a6c6842 100644
--- a/Imakefile
+++ b/Imakefile
@@ -31,10 +31,10 @@ install.man :: @@\
XCOMM compiler options
XCOMM
#if HasGcc
-EXTRACCOPTIONS = -Wall -Wpointer-arith -Wwrite-strings -Wtraditional
+EXTRACCOPTIONS = -Wall -Wpointer-arith -Wno-write-strings
#endif /* HasGcc */
#if defined(LinuxArchitecture)
-#define STATICDEBUG -static
+#define STATICDEBUG
XCOMM XINTL=-lXintl
#else
#define STATICDEBUG
@@ -61,7 +61,7 @@ TIME =
XCOMM TIME = -DUSETIME
XCOMM don't you have lockf or flock?
LOCK =
-LOCK = -DUSELOCKFILE
+XCOMM LOCK = -DUSELOCKFILE
XCOMM game defaults, you probably only want to alter the SCORE
XCOMM
@@ -69,9 +69,9 @@ XCOMM
/* #define thefont "-*-courier-*-r-*-*-18-*-*-*-m-*-*-*" */
XCOMM where is the high score file?
XCOMM SCORE = $(LOCAL)/lib/$(APP)
-SCORE = /var/lib/games/$(APP)
-/* to install default gardens not in app_defaults/$(APP)
-/* #define InstallDefaultGardens $(SCORE)/gardens */
+SCORE = /var/games/$(APP)
+/* to install default gardens not in /usr/share/$(APP) */
+/* #define InstallDefaultGardens $(DESTDIR)/usr/share/$(APP) */
XCOMM The following defines are needed for some implementations and/or sites.
XCOMM It is xmkmf's job to get these right in the first place.
@@ -91,7 +91,8 @@ XCOMM install parameters
XCOMM
XCOMM owner and access rights for executable & score directory
XCOMM these are set for a setuid xmris
-OWNER = -o games
+XCOMM OWNER = -o games
+OWNER =
INSTSCOREFLAGS = $(OWNER) -m 755
INSTMRISFLAGS = $(OWNER) $(INSTUIDFLAGS)
XCOMM normal install locations
@@ -115,7 +116,7 @@ FONT = thefont
#ifndef InstallDefaultGardens
#ifdef InstallAppDefFiles
-#define InstallDefaultGardens $(DESTDIR)/$(XAPPLOADDIR)/$(APP)
+#define InstallDefaultGardens $(DESTDIR)/usr/share/$(APP)
#endif
#endif
@@ -213,10 +214,6 @@ XCOMM using alltarget can cause gnumake to try and make a target called all.
XCOMM the reason is the All Target macro has no rules, so gnumake tries
XCOMM to find an implicit one. Other makes just give up.
all :: initialize
- @echo "NOTE:You might get lots of warnings about discarding const from"
- @echo "NOTE:pointer target type. Ignore these. It's because the X header"
- @echo "NOTE:files aren't const correct. Fiddle with XrmOptionDescRec in"
- @echo "NOTE:Xresource.h and String in Intrinsic.h by adding an _Xconst."
@#keep gnumake happy
all :: xmris xmred
@@ -238,9 +235,9 @@ NormalProgramTarget(xmris,$(MRISOBJS),$(DEPLIBS),$(LOCAL_LIBRARIES),)
InstallProgramWithFlags(xmris,$(THEBINDIR),$(INSTMRISFLAGS))
-install :: $(THEBINDIR)/xmris
- $(RM) $(THEBINDIR)/xmsit
- $(LN) ./xmris $(THEBINDIR)/xmsit
+install :: $(DESTDIR)$(THEBINDIR)/xmris
+ $(RM) $(DESTDIR)$(THEBINDIR)/xmsit
+ $(LN) xmris $(DESTDIR)$(THEBINDIR)/xmsit
XCOMM xmred build
NormalProgramTarget(xmred,$(MREDOBJS) $(WIDGETOBJS),$(DEPLIBS),$(LOCAL_LIBRARIES) -lm,)
--
1.7.5
0004-Catch-the-window-being-deleted.patch:
xmris.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
--- NEW FILE 0004-Catch-the-window-being-deleted.patch ---
>From 5ffc5a653acb6f4d9747f98d05e3a86119baeb9f Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Mon, 29 Nov 2010 22:28:49 +0100
Subject: [PATCH 04/20] Catch the window being deleted
This fixes the keyboard repeat getting fsck-ed up when quiting using
the window delete button on the title bar / alt+f4 while playing the game.
This patch comes from the Mandriva SRPM, thanks guys!
---
xmris.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/xmris.c b/xmris.c
index 77cd0ea..22fa1af 100644
--- a/xmris.c
+++ b/xmris.c
@@ -55,6 +55,8 @@ static VOIDFUNC action_pause
PROTOARG((Widget, XEvent *, String *, Cardinal *));
static VOIDFUNC action_unmap
PROTOARG((Widget, XEvent *, String *, Cardinal *));
+static VOIDFUNC action_quit
+ PROTOARG((Widget, XEvent *, String *, Cardinal *));
static VOIDFUNC age_scores PROTOARG((VOIDARG));
static PROTOANIMATE(animate_death);
static PROTOANIMATE(animate_pause);
@@ -75,6 +77,7 @@ static XtActionsRec actions[] =
{"map", action_map},
{"unmap", action_unmap},
{"expose", action_expose},
+ {"quit", action_quit},
};
/*}}}*/
/*{{{ static char CONST garden_translations[] =*/
@@ -96,6 +99,7 @@ static char CONST toplevel_translations[] =
"\
<MapNotify>:map()\n\
<UnmapNotify>:unmap()\n\
+<Message>WM_PROTOCOLS: quit()\n\
";
/*}}}*/
/*}}}*/
@@ -116,6 +120,22 @@ ARGSEP Cardinal *num_params
return;
}
/*}}}*/
+/*{{{ void action_quit(widget, event, params, num_params)*/
+static VOIDFUNC action_quit
+FUNCARG((widget, event, params, num_params),
+ Widget widget
+ARGSEP XEvent *event
+ARGSEP String *params
+ARGSEP Cardinal *num_params
+)
+{
+#ifdef DEBUGEVENTLOOP
+ fprintf(stderr, "action_quit(0x%lx)\n", XtWindow(widget));
+#endif /* DEBUGEVENTLOOP */
+ set_key_default();
+ global.quit = 1;
+}
+/*}}}*/
/*{{{ void action_keypress(widget, event, params, num_params)*/
static VOIDFUNC action_keypress
FUNCARG((widget, event, params, num_params),
@@ -1235,6 +1255,7 @@ ARGSEP char CONST **argv
)
{
PROTOANIMATE((*animate));
+ Atom wm_delete_window;
myname = *argv ? *argv : "Xmris";
#ifndef TRANSPUTER
@@ -1280,6 +1301,10 @@ ARGSEP char CONST **argv
XtOverrideTranslations(display.toplevel,
XtParseTranslationTable(toplevel_translations));
XtRealizeWidget(display.toplevel);
+ wm_delete_window = XInternAtom(XtDisplay(display.toplevel), "WM_DELETE_WINDOW",
+ False);
+ (void)XSetWMProtocols(XtDisplay(display.toplevel), XtWindow(display.toplevel),
+ &wm_delete_window, 1);
#ifdef DEBUGEVENTLOOP
printf("Toplevel is 0x%lx\n", (long)XtWindow(display.toplevel));
printf("Garden is 0x%lx\n", (long)XtWindow(display.garden));
--
1.7.5
0005-Fix-compiling-of-flock-code-under-Linux.patch:
scoring.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- NEW FILE 0005-Fix-compiling-of-flock-code-under-Linux.patch ---
>From 51f13c5ef15a4a63e5184579ac1ddc8fab03382b Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Mon, 29 Nov 2010 23:30:59 +0100
Subject: [PATCH 05/20] Fix compiling of flock code under Linux
---
scoring.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/scoring.c b/scoring.c
index 0c61b9b..6f1030f 100644
--- a/scoring.c
+++ b/scoring.c
@@ -38,6 +38,9 @@
/*}}}*/
/*{{{ file locking*/
#ifndef SYSV
+#ifdef linux
+#include <sys/file.h>
+#endif
#define lock_file(stream) flock(fileno(stream), LOCK_EX)
#define unlock_file(stream) flock(fileno(stream), LOCK_UN)
#else
--
1.7.5
0006-Fix-key-presses-getting-lost.patch:
xmris.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- NEW FILE 0006-Fix-key-presses-getting-lost.patch ---
>From 3acb9936eb6ec40de5188c47e5a720d375657ba8 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Tue, 30 Nov 2010 15:00:29 +0100
Subject: [PATCH 06/20] Fix key presses getting lost
Without this patch keypresses get lost when the mouse is outside the window,
but the keyboard focus is on the window.
---
xmris.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/xmris.c b/xmris.c
index 22fa1af..2f6cc62 100644
--- a/xmris.c
+++ b/xmris.c
@@ -91,6 +91,8 @@ static char CONST garden_translations[] =
/*{{{ static char CONST form_translations[] =*/
static char CONST form_translations[] =
"\
+<KeyPress>:keypress()\n\
+<KeyRelease>:keyrelease()\n\
<FocusOut>:pause()\n\
";
/*}}}*/
--
1.7.5
0007-Change-key-binding-defaults-to-something-sane.patch:
Xmris-ad.src | 8 ++++----
defcom.c | 8 ++++----
xmris.man | 22 ++++------------------
3 files changed, 12 insertions(+), 26 deletions(-)
--- NEW FILE 0007-Change-key-binding-defaults-to-something-sane.patch ---
>From dc28065b144dbfa1da8007b4482f8415894eee43 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Tue, 30 Nov 2010 15:55:00 +0100
Subject: [PATCH 07/20] Change key binding defaults to something sane
---
Xmris-ad.src | 8 ++++----
defcom.c | 8 ++++----
xmris.man | 21 ++++-----------------
3 files changed, 12 insertions(+), 25 deletions(-)
diff --git a/Xmris-ad.src b/Xmris-ad.src
index fd94b76..60be0ac 100644
--- a/Xmris-ad.src
+++ b/Xmris-ad.src
@@ -4,10 +4,10 @@
! These are some of the resources you can fiddle with for xmris
! The defaults are shown in the man page.
-*Up: apostrophe
-*Down: slash
-*Left: z
-*Right: x
+*Up: Up
+*Down: Down
+*Left: Left
+*Right: Right
*Throw: space
*Pause: p
*Quit: q
diff --git a/defcom.c b/defcom.c
index f8a59b5..5934c5e 100644
--- a/defcom.c
+++ b/defcom.c
@@ -234,13 +234,13 @@ XtResource resources[] =
{"dir", "Dir", XtRString, sizeof(String),
XtOffsetOf(DATA, dir), XtRString, (XtPointer)SCORE_DIR},
{"up", "Up", XtRKeySym, sizeof(KeySym),
- XtOffsetOf(DATA, keysyms[0]), XtRString, (XtPointer)"apostrophe"},
+ XtOffsetOf(DATA, keysyms[0]), XtRString, (XtPointer)"Up"},
{"down", "Down", XtRKeySym, sizeof(KeySym),
- XtOffsetOf(DATA, keysyms[1]), XtRString, (XtPointer)"slash"},
+ XtOffsetOf(DATA, keysyms[1]), XtRString, (XtPointer)"Down"},
{"left", "Left", XtRKeySym, sizeof(KeySym),
- XtOffsetOf(DATA, keysyms[2]), XtRString, (XtPointer)"z"},
+ XtOffsetOf(DATA, keysyms[2]), XtRString, (XtPointer)"Left"},
{"right", "Right", XtRKeySym, sizeof(KeySym),
- XtOffsetOf(DATA, keysyms[3]), XtRString, (XtPointer)"x"},
+ XtOffsetOf(DATA, keysyms[3]), XtRString, (XtPointer)"Right"},
{"throw", "Throw", XtRKeySym, sizeof(KeySym),
XtOffsetOf(DATA, keysyms[KEY_THROW]), XtRString, (XtPointer)"space"},
{"pause", "Pause", XtRKeySym, sizeof(KeySym),
diff --git a/xmris.man b/xmris.man
index 0d69f88..1e7c47f 100644
--- a/xmris.man
+++ b/xmris.man
@@ -401,14 +401,14 @@ defaults in '[]'.)
.br
.ne 11
.TP
-.B Xmris.Up: \fIkeysym\fP [apostrophe]
+.B Xmris.Up: \fIkeysym\fP [Up]
.PD 0
.TP
-.B Xmris.Down: \fIkeysym\fP [slash]
+.B Xmris.Down: \fIkeysym\fP [Down]
.TP
-.B Xmris.Left: \fIkeysym\fP [z]
+.B Xmris.Left: \fIkeysym\fP [Left]
.TP
-.B Xmris.Right: \fIkeysym\fP [x]
+.B Xmris.Right: \fIkeysym\fP [Right]
.TP
.B Xmris.Throw: \fIkeysym\fP [space]
.TP
@@ -493,19 +493,6 @@ Set the number of distinct colours allocated from the colour map.
.B Xmris.Static: \fI{yes, no}\fP [no]
Do not use dynamic background colors.
.PP
-For example, if you want to use the arrow keys, the following will work
-.br
-.ne 6
-.IP
-Xmris.Up: Up
-.br
-Xmris.Down: Down
-.br
-Xmris.Left: Left
-.br
-Xmris.Right: Right
-.br
-.PP
In addition, you have the normal resources such as '*Font'.
.PP
Normally the cursor is invisible in the Mr Is window. You can force
--
1.7.5
0008-Fix-compiler-warnings.patch:
Drag.c | 3 +--
Icon.c | 3 +--
PixmapList.c | 23 ++++++++++-------------
control.c | 35 +++++++++++++++++------------------
dialogs.c | 8 ++++----
makemred.c | 2 +-
makemris.c | 4 ++--
menubar.c | 12 ++++++------
player.c | 4 ++--
scram.c | 3 +--
10 files changed, 45 insertions(+), 52 deletions(-)
--- NEW FILE 0008-Fix-compiler-warnings.patch ---
>From 383d6b1c86c0697f422e169499ba84c1231f7df5 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Fri, 29 Apr 2011 16:14:33 +0200
Subject: [PATCH 08/20] Fix compiler warnings
---
Drag.c | 3 +--
Icon.c | 3 +--
PixmapList.c | 23 ++++++++++-------------
control.c | 35 +++++++++++++++++------------------
dialogs.c | 8 ++++----
makemred.c | 2 +-
makemris.c | 4 ++--
menubar.c | 12 ++++++------
player.c | 4 ++--
scram.c | 2 +-
10 files changed, 45 insertions(+), 51 deletions(-)
diff --git a/Drag.c b/Drag.c
index 32e863b..6376614 100644
--- a/Drag.c
+++ b/Drag.c
@@ -510,9 +510,8 @@ FUNCARG((widget),
int x, y;
unsigned border;
unsigned depth;
- Status status;
- status = XGetGeometry(XtDisplay(widget), widget->drag.pixmap, &root,
+ XGetGeometry(XtDisplay(widget), widget->drag.pixmap, &root,
&x, &y, &widget->drag.width, &widget->drag.height, &border, &depth);
}
else
diff --git a/Icon.c b/Icon.c
index 215c979..d54a239 100644
--- a/Icon.c
+++ b/Icon.c
@@ -620,9 +620,8 @@ FUNCARG((widget),
int x, y;
unsigned border;
unsigned depth;
- Status status;
- status = XGetGeometry(XtDisplay(widget), widget->icon.pixmap, &root,
+ XGetGeometry(XtDisplay(widget), widget->icon.pixmap, &root,
&x, &y, &widget->icon.width, &widget->icon.height, &border, &depth);
}
else
diff --git a/PixmapList.c b/PixmapList.c
index ab128fa..aeb7155 100644
--- a/PixmapList.c
+++ b/PixmapList.c
@@ -1199,9 +1199,8 @@ ARGSEP PixmapInfo *pi
int x, y;
unsigned border;
unsigned depth;
- Status status;
- status = XGetGeometry(XtDisplay(plw), pi->pixmap,
+ XGetGeometry(XtDisplay(plw), pi->pixmap,
&root, &x, &y, (unsigned int *)&pi->width,
(unsigned int *)&pi->height, &border, &depth);
}
@@ -1359,12 +1358,12 @@ ARGSEP XtPointer call
int length;
plw = (PixmapListWidget)client;
- if(!(int)call)
+ if(!(long)call)
return;
length = plw->pixmap_list.orient == XtorientVertical ?
plw->core.height : plw->core.width;
start = length / 2;
- if((int)call > 0)
+ if((long)call > 0)
start = -start;
start -= plw->pixmap_list.orient == XtorientVertical ?
plw->pixmap_list.y : plw->pixmap_list.x;
@@ -1410,23 +1409,21 @@ FUNCARG((plw),
* our geometry changes
*/
{
- float shown, top;
+ union { float f; XtArgVal xav; } shown, top;
Arg args[2];
if(!plw->pixmap_list.scroll)
return;
- shown = (float)(plw->pixmap_list.orient == XtorientVertical ?
+ shown.f = (float)(plw->pixmap_list.orient == XtorientVertical ?
plw->core.height + 1 : plw->core.width + 1) /
(float)plw->pixmap_list.length;
- if(shown > (float)1.0)
- shown = (float)1.0;
- top = (float)(plw->pixmap_list.orient == XtorientVertical ?
+ if(shown.f > (float)1.0)
+ shown.f = (float)1.0;
+ top.f = (float)(plw->pixmap_list.orient == XtorientVertical ?
-plw->pixmap_list.y : -plw->pixmap_list.x) /
(float)plw->pixmap_list.length;
- XtSetArg(args[0], XtNtopOfThumb, sizeof(float) > sizeof(XtArgVal) ?
- (XtArgVal)&top : *(XtArgVal *)&top);
- XtSetArg(args[1], XtNshown, sizeof(float) > sizeof(XtArgVal) ?
- (XtArgVal)&shown : *(XtArgVal *)&shown);
+ XtSetArg(args[0], XtNtopOfThumb, top.xav);
+ XtSetArg(args[1], XtNshown, shown.xav);
XtSetValues(plw->pixmap_list.scroll, args, 2);
return;
}
diff --git a/control.c b/control.c
index 8261ad4..d5059b4 100644
--- a/control.c
+++ b/control.c
@@ -373,7 +373,7 @@ ARGSEP XtPointer call
{
int delta;
- delta = (int)call ? (int)call < 0 ? -1 : 1 : 0;
+ delta = (long)call ? (long)call < 0 ? -1 : 1 : 0;
if((delta >= 0 || state.counts[5]) && (delta <= 0 ||
state.counts[5] != APPLE_LIMIT))
adjust_count(5, delta);
@@ -431,7 +431,7 @@ ARGSEP XtPointer call
IconCallback *call_data;
int option;
- option = state.button[(unsigned)client];
+ option = state.button[(unsigned long)client];
call_data = (IconCallback *)call;
if(option == OPTION_APPLES)
select_apple(call_data->selection);
@@ -454,13 +454,13 @@ ARGSEP XtPointer call
{
if(state.edit)
{
- state.edit->board->colors = (unsigned)client;
+ state.edit->board->colors = (unsigned long)client;
paint_garden_icon(state.edit);
paint_garden_image();
repaint_garden_icon();
changed_flag |= state.change;
}
- set_icon_color((unsigned)client);
+ set_icon_color((unsigned long)client);
return;
}
/*}}}*/
@@ -477,13 +477,13 @@ ARGSEP XtPointer call
{
if(state.edit)
{
- state.edit->board->fill = (unsigned)client;
+ state.edit->board->fill = (unsigned long)client;
paint_garden_icon(state.edit);
paint_garden_image();
repaint_garden_icon();
changed_flag |= state.change;
}
- set_icon_fill((unsigned)client);
+ set_icon_fill((unsigned long)client);
return;
}
/*}}}*/
@@ -498,9 +498,9 @@ ARGSEP XtPointer call
* change the display mode and update the garden
*/
{
- if(state.mode != (unsigned)client)
+ if(state.mode != (unsigned long)client)
{
- state.mode = (unsigned)client;
+ state.mode = (unsigned long)client;
paint_garden_icon(state.edit);
paint_garden_image();
repaint_garden_icon();
@@ -525,7 +525,7 @@ ARGSEP XtPointer call
IconCallback *call_data;
unsigned option;
- option = (unsigned)client;
+ option = (unsigned long)client;
call_data = (IconCallback *)call;
if(option == OPTION_APPLES)
if(select_apple(call_data->selection))
@@ -802,36 +802,35 @@ FUNCARG((root),
/*{{{ set option callback*/
for(gptr = &gizmos[GIZMO_OPTIONS + OPTIONS - 1], ix = OPTIONS;
ix--; gptr--)
- XtAddCallback(gptr->widget, XtNcallback, command_option, (XtPointer)ix);
+ XtAddCallback(gptr->widget, XtNcallback, command_option, (XtPointer)(unsigned long)ix);
/*}}}*/
/*{{{ set fill callback*/
for(gptr = &gizmos[GIZMO_FILLS + FILLS - 1], ix = FILLS; ix--; gptr--)
- XtAddCallback(gptr->widget, XtNcallback, command_fill, (XtPointer)ix);
+ XtAddCallback(gptr->widget, XtNcallback, command_fill, (XtPointer)(unsigned long)ix);
/*}}}*/
/*{{{ set color callback*/
for(gptr = &gizmos[GIZMO_COLORS + BACKGROUNDS - 1], ix = BACKGROUNDS;
ix--; gptr--)
- XtAddCallback(gptr->widget, XtNcallback, command_color, (XtPointer)ix);
+ XtAddCallback(gptr->widget, XtNcallback, command_color, (XtPointer)(unsigned long)ix);
/*}}}*/
/*{{{ set mode callback*/
for(gptr = &gizmos[GIZMO_DISPLAY_BASE + MODES - 1], ix = MODES;
ix--; gptr--)
- XtAddCallback(gptr->widget, XtNcallback, command_mode, (XtPointer)ix);
+ XtAddCallback(gptr->widget, XtNcallback, command_mode, (XtPointer)(unsigned long)ix);
/*}}}*/
/*{{{ set button callback*/
for(gptr = &gizmos[GIZMO_BUTTONS + BUTTONS - 1], ix = BUTTONS;
ix--; gptr--)
- XtAddCallback(gptr->widget, XtNcallback, command_button, (XtPointer)ix);
+ XtAddCallback(gptr->widget, XtNcallback, command_button, (XtPointer)(unsigned long)ix);
/*}}}*/
/*{{{ setup apple scrollbar*/
{
- float shown;
+ union { float f; XtArgVal xav; } shown;
Arg arg[1];
gptr = &gizmos[GIZMO_TOTAL_WARNINGS + 5];
- shown = (float)1.0;
- XtSetArg(arg[0], XtNshown, sizeof(float) > sizeof(XtArgVal) ?
- (XtArgVal)&shown : *(XtArgVal *)&shown);
+ shown.f = (float)1.0;
+ XtSetArg(arg[0], XtNshown, shown.xav);
XtSetValues(gptr->widget, arg, 1);
XtAddCallback(gptr->widget, XtNjumpProc, apple_jump, (XtPointer)NULL);
XtAddCallback(gptr->widget, XtNscrollProc, apple_scroll, (XtPointer)NULL);
diff --git a/dialogs.c b/dialogs.c
index 43410b5..9d864e4 100644
--- a/dialogs.c
+++ b/dialogs.c
@@ -87,7 +87,7 @@ ARGSEP Cardinal *argc
for(optr = dialog_options; optr->text; optr ++)
if(!strcmp(optr->text, *argv))
{
- dialog_option(widget, (XtPointer)optr->option, (XtPointer)NULL);
+ dialog_option(widget, (XtPointer)(unsigned long)optr->option, (XtPointer)NULL);
break;
}
return;
@@ -135,7 +135,7 @@ ARGSEP XtPointer call
widget = XtParent(widget);
if(!widget)
/* EMPTY */;
- else if((unsigned)client == DIALOG_CLEAR)
+ else if((unsigned long)client == DIALOG_CLEAR)
{
Widget text;
@@ -160,7 +160,7 @@ ARGSEP XtPointer call
if(dptr->dialog == widget)
{
dptr->selection |=
- (unsigned)client & dptr->options;
+ (unsigned long)client & dptr->options;
if(dptr->selection && dptr->up)
{
dptr->up = 0;
@@ -320,7 +320,7 @@ FUNCARG((root),
if(optr->option & (1 << count))
{
XawDialogAddButton(dptr->dialog, optr->text,
- dialog_option, (XtPointer)(1 << count));
+ dialog_option, (XtPointer)(unsigned long)(1 << count));
break;
}
}
diff --git a/makemred.c b/makemred.c
index 18aa078..ee1f7a1 100644
--- a/makemred.c
+++ b/makemred.c
@@ -492,7 +492,7 @@ ARGSEP String *argv
/* EMPTY */;
display.toplevel = XtAppInitialize(&display.context, "Xmris",
options, (Cardinal)(ptr - options),
- (Cardinal *)&argc, (String *)argv,
+ &argc, (String *)argv,
(String *)fallback_resources,
toplevel_args, XtNumber(toplevel_args));
if(argc > 1)
diff --git a/makemris.c b/makemris.c
index 9ea2bb5..4bf8d20 100644
--- a/makemris.c
+++ b/makemris.c
@@ -282,7 +282,7 @@ ARGSEP String *argv
/* EMPTY */;
display.toplevel = XtAppInitialize(&display.context, "Xmris",
options, (Cardinal)(ptr - options),
- (Cardinal *)&argc, (String *)argv,
+ &argc, (String *)argv,
(String *)NULL, toplevel_args, XtNumber(toplevel_args));
}
if(argc > 1)
@@ -309,7 +309,7 @@ ARGSEP String *argv
/*{{{ some more setup*/
{
XtResource CONST *ptr;
- char CONST *dir;
+ char *dir;
XtAppSetTypeConverter(display.context, XtRString, XtRKeySym,
convert_string2keysym, (XtConvertArgRec *)NULL, 0, XtCacheNone,
diff --git a/menubar.c b/menubar.c
index 616a70c..57db711 100644
--- a/menubar.c
+++ b/menubar.c
@@ -147,7 +147,7 @@ ARGSEP XtPointer call
char CONST *error;
int insert;
- if((unsigned)client == GIZMO_FILE_LOAD - GIZMO_FILE_BASE)
+ if((unsigned long)client == GIZMO_FILE_LOAD - GIZMO_FILE_BASE)
{
if(!check_saved(CHANGED_ANY))
return;
@@ -166,7 +166,7 @@ ARGSEP XtPointer call
dialog = DIALOG_FILE_ERROR;
title = "Cannot load";
menu_filename(result);
- if((unsigned)client == GIZMO_FILE_LOAD - GIZMO_FILE_BASE)
+ if((unsigned long)client == GIZMO_FILE_LOAD - GIZMO_FILE_BASE)
free_descriptors();
error = load_boards(filename, insert);
}
@@ -174,7 +174,7 @@ ARGSEP XtPointer call
break;
}
while(error);
- if((unsigned)client == GIZMO_FILE_LOAD - GIZMO_FILE_BASE)
+ if((unsigned long)client == GIZMO_FILE_LOAD - GIZMO_FILE_BASE)
changed_flag = 0;
return;
}
@@ -234,7 +234,7 @@ ARGSEP XtPointer call
char CONST *error;
XtVaGetValues(widget, XtNlabel, &title, NULL);
- dialog = filename && *filename && (unsigned)client ==
+ dialog = filename && *filename && (unsigned long)client ==
GIZMO_FILE_SAVE - GIZMO_FILE_BASE ? -1 : DIALOG_FILENAME;
error = NULL;
option = DIALOG_NONE;
@@ -475,10 +475,10 @@ FUNCARG((root),
create_gizmos(root, gizmos, XtNumber(gizmos));
for(ix = XtNumber(file_callbacks); ix--;)
XtAddCallback(gizmos[GIZMO_FILE_BASE + ix].widget,
- XtNcallback, file_callbacks[ix], (XtPointer)ix);
+ XtNcallback, file_callbacks[ix], (XtPointer)(unsigned long)ix);
for(ix = XtNumber(garden_callbacks); ix--;)
XtAddCallback(gizmos[GIZMO_GARDEN_BASE + ix].widget,
- XtNcallback, garden_callbacks[ix], (XtPointer)ix);
+ XtNcallback, garden_callbacks[ix], (XtPointer)(unsigned long)ix);
menu_filename(NULL);
menu_total(0);
return;
diff --git a/player.c b/player.c
index 560fb1d..944393f 100644
--- a/player.c
+++ b/player.c
@@ -8,8 +8,8 @@ extern VOIDFUNC bounce_ball FUNCARGVOID
* bouncing the ball is rather involved
*/
{
- COORD tl;
- COORD br;
+ COORD tl = { 0, 0 };
+ COORD br = { 0, 0 };
CELL *cptr;
CELL *optr;
diff --git a/scram.c b/scram.c
index 62546e7..7d34d33 100644
--- a/scram.c
+++ b/scram.c
@@ -113,7 +113,7 @@ ARGSEP BITMAP *bitmap /* bitmap ptr */
FILE *stream;
unsigned state;
char line[128];
- SIZE place;
+ SIZE place = { 0, 0 };
unsigned extra;
stream = fopen(name, "r");
--
1.7.5
0009-Remove-TRANSPUTER-stuff.patch:
common.h | 4 ---
defcom.c | 6 -----
scoring.c | 49 ------------------------------------------
scram.c | 4 ---
timer.c | 71 --------------------------------------------------------------
xmris.c | 2 -
xmris.h | 12 ----------
7 files changed, 148 deletions(-)
--- NEW FILE 0009-Remove-TRANSPUTER-stuff.patch ---
>From 361a5e7c3ebfbbe7fecbdbdd9d5f7497679f3be1 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Fri, 29 Apr 2011 17:17:12 +0200
Subject: [PATCH 09/20] Remove TRANSPUTER stuff
This is not used (never defined by any makefiles) and obfuscates the code
needlessly. Removing this is a preparation step for cleaning up the highscore
support for dropping setgid rights directly on start, rather then using
unsafe seteg/uid tricks.
---
common.h | 4 ---
defcom.c | 6 -----
scoring.c | 49 ------------------------------------------
scram.c | 4 ---
timer.c | 71 -------------------------------------------------------------
xmris.c | 2 -
xmris.h | 11 ---------
7 files changed, 0 insertions(+), 147 deletions(-)
diff --git a/common.h b/common.h
index e1fd8dd..0babbce 100644
--- a/common.h
+++ b/common.h
@@ -16,9 +16,7 @@
#include <errno.h>
#include <ctype.h>
#include <time.h>
-#ifndef TRANSPUTER
#include <unistd.h>
-#endif /* TRANSPUTER */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
@@ -294,9 +292,7 @@ typedef struct Data
Boolean username; /* use username of user */
Boolean nodynamic; /* don't take advantage of dynamic visuals */
Boolean nodisplay; /* don't open the display, even to get X resources */
-#ifndef TRANSPUTER
Boolean busywait; /* do busy waiting */
-#endif /* TRANSPUTER */
#endif /* XMRED */
Boolean gender; /* he or she? */
int distinct; /* distinct colors allocated */
diff --git a/defcom.c b/defcom.c
index 5934c5e..9715fe9 100644
--- a/defcom.c
+++ b/defcom.c
@@ -219,9 +219,7 @@ XrmOptionDescRec options[] =
{"-username",".username", XrmoptionNoArg, (XtPointer)XtEyes},
{"-realname",".username", XrmoptionNoArg, (XtPointer)XtEno},
{"-static", ".static", XrmoptionNoArg, (XtPointer)XtEyes},
-#ifndef TRANSPUTER
{"-busywait", ".busywait", XrmoptionNoArg, (XtPointer)XtEyes},
-#endif /* TRANSPUTER */
#endif /* XMRED */
{NULL}
};
@@ -259,10 +257,8 @@ XtResource resources[] =
XtOffsetOf(DATA, username), XtRImmediate, (XtPointer)False},
{"static", "Static", XtRBoolean, sizeof(Boolean),
XtOffsetOf(DATA, nodynamic), XtRImmediate, (XtPointer)False},
-#ifndef TRANSPUTER
{"busywait", "Busywait", XtRBoolean, sizeof(Boolean),
XtOffsetOf(DATA, busywait), XtRImmediate, (XtPointer)False},
-#endif /* TRANSPUTER */
#endif /* XMRED */
{XtNfont, XtCFont, XtRFont, sizeof(Font),
XtOffsetOf(DATA, font), XtRString, (XtPointer)FONT_NAME},
@@ -394,9 +390,7 @@ HELP CONST help[] =
{"Remove user's scores", "-remove", "", "<name>"},
{"Do not open display", "+display", "", ""},
{"Store date format change", "-format", "", ""},
-#ifndef TRANSPUTER
{"Force busywaiting", "-busywait", "Busywait:yes", ""},
-#endif /* TRANSPUTER */
#endif /* XMRED */
{NULL}
};
diff --git a/scoring.c b/scoring.c
index 6f1030f..b63c2b6 100644
--- a/scoring.c
+++ b/scoring.c
@@ -26,15 +26,11 @@
/*}}}*/
#include "xmris.h"
/*{{{ other includes*/
-#ifdef TRANSPUTER
-#include <iocntrl.h>
-#else
#include <pwd.h>
#include <sys/stat.h>
#ifdef USELOCKFILE
#include <fcntl.h>
#endif /* USELOCKFILE */
-#endif /* TRANSPUTER */
/*}}}*/
/*{{{ file locking*/
#ifndef SYSV
@@ -131,9 +127,6 @@ ARGSEP uid_t uid
* so that we pick up the new scores
*/
{
-#ifdef TRANSPUTER
- return 1; /* assume that it has changed */
-#else
static time_t last_time[2];
struct stat buffer;
unsigned changed;
@@ -151,7 +144,6 @@ ARGSEP uid_t uid
if(real_uid != current_uid)
set_euid((current_uid = real_uid));
return changed;
-#endif /* TRANSPUTER */
}
/*}}}*/
/*{{{ void get_lock(name, flag, uid)*/
@@ -172,34 +164,6 @@ ARGSEP uid_t uid
{
FILE *stream;
-#ifdef TRANSPUTER
- if(locking_file && !locks)
- /*{{{ attempt file lock*/
- {
- unsigned count;
- FILE *lock;
-
- for(count = 3; count; count--)
- {
- lock = fopen(locking_file, "r");
- if(lock)
- {
- fclose(lock);
- sleep(1);
- }
- else
- {
- lock = fopen(locking_file, "w");
- if(lock)
- fclose(lock);
- else
- perror(locking_file);
- break;
- }
- }
- }
- /*}}}*/
-#else
#ifdef USELOCKFILE
if(locking_file && !locks)
/*{{{ attempt exclusive file lock*/
@@ -235,7 +199,6 @@ ARGSEP uid_t uid
#endif /* USELOCKFILE */
if(uid != current_uid)
set_euid((current_uid = uid));
-#endif /* TRANSPUTER */
stream = fopen(name, flag & 1 ? "w+" : "r+");
if(!stream && !(flag & 2))
perror(name);
@@ -244,10 +207,8 @@ ARGSEP uid_t uid
locks++;
else if(locking_file && !locks)
{
-#ifndef TRANSPUTER
if(current_uid != effective_uid)
set_euid((current_uid = effective_uid));
-#endif /* TRANSPUTER */
unlink(locking_file);
}
#else
@@ -260,12 +221,10 @@ ARGSEP uid_t uid
}
/*}}}*/
#endif /* USELOCKFILE */
-#ifndef TRANSPUTER
if(stream && flag & 4 && effective_uid == real_uid)
chmod(name, 0666); /* not everyone has fchmod */
if(current_uid != real_uid)
set_euid((current_uid = real_uid));
-#endif /* TRANSPUTER */
return stream;
}
/*}}}*/
@@ -284,15 +243,11 @@ FUNCARG((stream),
locks--;
if(locking_file && locks)
{
-#ifndef TRANSPUTER
if(current_uid != effective_uid)
set_euid((current_uid = effective_uid));
-#endif
unlink(locking_file);
-#ifndef TRANSPUTER
if(current_uid != real_uid)
set_euid((current_uid = real_uid));
-#endif /* TRANSPUTER */
}
#else
rewind(stream);
@@ -342,7 +297,6 @@ extern VOIDFUNC init_scores FUNCARGVOID
user = NULL;
home = NULL;
reallife = NULL;
-#ifndef TRANSPUTER
/*{{{ read passwd information*/
{
struct passwd *ptr;
@@ -409,7 +363,6 @@ extern VOIDFUNC init_scores FUNCARGVOID
}
}
/*}}}*/
-#endif
scoring.mine.score = 0;
/*{{{ set username*/
{
@@ -720,7 +673,6 @@ FUNCARG((insert),
personal = 0;
truename = home = NULL;
-#ifndef TRANSPUTER
/*{{{ find name & home*/
{
struct passwd *ptr;
@@ -733,7 +685,6 @@ FUNCARG((insert),
}
}
/*}}}*/
-#endif /* TRANSPUTER */
/*{{{ search*/
for(found = index = 0; index != 2; index++)
{
diff --git a/scram.c b/scram.c
index 7d34d33..d68cf03 100644
--- a/scram.c
+++ b/scram.c
@@ -25,11 +25,7 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#ifdef TRANSPUTER
-#include <iocntrl.h>
-#else
#include <unistd.h>
-#endif /* TRANSPUTER */
/*}}}*/
#define SUFFIXMONO ".bw"
#define SUFFIXCOLOR ".rgb"
diff --git a/timer.c b/timer.c
index c8fa2c1..028f8f0 100644
--- a/timer.c
+++ b/timer.c
@@ -54,12 +54,8 @@
*/
/*}}}*/
#include "xmris.h"
-#ifdef TRANSPUTER
-#include <process.h>
-#else
#include <sys/time.h>
#include <signal.h>
-#endif
#ifdef SVR4
#ifndef SYSV
#define SYSV
@@ -74,7 +70,6 @@
* reblocks the signal
* signal_release returns the block mask to what it was before signal_hold
*/
-#ifndef TRANSPUTER
#if defined POSIX || defined linux
# define MASK sigset_t
# define signal_hold(signal, maskp) \
@@ -125,7 +120,6 @@
# endif /* SYSV */
# endif /* __hpux */
#endif /* POSIX */
-#endif /* TRANSPUTER */
/*}}}*/
/*{{{ get current time*/
/* TICKTIME specifies how many microseconds in each timer tick
@@ -133,14 +127,6 @@
* BUSYWAIT is set if the timer is precise enough for busywait code
* to work
*/
-#ifdef TRANSPUTER
-# define gettick(ptr) (*(ptr) = ProcTime())
-# define TICKTIME (unsigned long)64
-# define tickdelta(later, earlier) ProcTimeMinus(later, earlier)
-# define tickafter(later, earlier) ProcTimerAfter(later, earlier)
-# define tickadd(time, interval) ProcTimePlus(time, interval)
- typedef int tick_t;
-#else
# ifdef USETIME
# define gettick(ptr) (*(ptr) = time((time_t *)NULL))
# define TICKTIME (unsigned long)1000000
@@ -181,17 +167,12 @@
(tickdelta(later, earlier) < ~(~(unsigned long)0 >> 1))
typedef unsigned long tick_t;
# endif /* USETIME */
-#endif /* TRANSPUTER */
/*}}}*/
/*{{{ timer*/
static struct
{
VOIDFUNC (*handler) PROTOARG((int)); /* original handler */
unsigned long usec; /* interval time in usec */
-#ifdef TRANSPUTER
- tick_t delay; /* tickdelay waiting */
- tick_t timeout; /* when the next one should timeout */
-#else
struct itimerval interval; /* internal interval time */
unsigned VOLATILE elapsed; /* timer elapsed */
unsigned VOLATILE waiting; /* waiting for the interrupt */
@@ -201,7 +182,6 @@ static struct
tick_t timeout; /* timeout */
tick_t delay; /* interval delay */
#endif /* BUSYWAIT */
-#endif /* TRANSPUTER */
unsigned state; /* timing state */
tick_t game; /* start of game tick */
tick_t start; /* timing start */
@@ -226,26 +206,11 @@ static unsigned next;
/*}}}*/
#endif
/*{{{ prototypes*/
-#ifndef TRANSPUTER
static VOIDFUNC timer_alarm PROTOARG((int));
-#endif /* TRANSPUTER */
#ifndef NDEBUG
static VOIDFUNC timer_debug PROTOARG((char CONST *));
#endif
/*}}}*/
-#ifdef TRANSPUTER
-/*{{{ void sleep(delay)*/
-extern VOIDFUNC sleep
-FUNCARG((delay),
- unsigned delay
-)
-{
- ProcWait((int)(delay * (1000000 / TICKTIME)));
- return;
-}
-/*}}}*/
-#endif /* TRANSPUTER */
-#ifndef TRANSPUTER
/*{{{ void timer_alarm(sig)*/
static VOIDFUNC timer_alarm
/* ARGSUSED */
@@ -297,14 +262,12 @@ FUNCARG((sig),
return;
}
/*}}}*/
-#endif /* TRANSPUTER */
/*{{{ void timer_close()*/
extern VOIDFUNC timer_close FUNCARGVOID
/*
* closes the timer stuff
*/
{
-#ifndef TRANSPUTER
if(data.busywait == False)
{
MASK mask;
@@ -322,7 +285,6 @@ extern VOIDFUNC timer_close FUNCARGVOID
signal(SIGALRM, timer.handler);
#endif /* USESIGSET */
}
-#endif /* TRANSPUTER */
return;
}
/*}}}*/
@@ -354,10 +316,6 @@ extern VOIDFUNC timer_open FUNCARGVOID
* and starting the first tick
*/
{
-#ifdef TRANSPUTER
- assert(ProcGetPriority());
- gettick(&timer.timeout);
-#else
if(data.busywait != False)
# ifdef BUSYWAIT
{
@@ -382,7 +340,6 @@ extern VOIDFUNC timer_open FUNCARGVOID
#endif /* USESIGSET */
timer.waiting = 0;
timer.elapsed = 1;
-#endif /* TRANSPUTER */
#ifndef NDEBUG
timer_debug("Init");
#endif
@@ -418,14 +375,10 @@ ARGSEP unsigned state
assert(t1 || t2);
}
timer.usec = tick;
-#ifdef TRANSPUTER
- timer.delay = (tick_t)(tick / TICKTIME);
-#else
#ifdef BUSYWAIT
timer.delay = (tick_t)(tick / TICKTIME);
#endif /* BUSYWAIT */
timer.interval.it_value.tv_usec = tick;
-#endif /* TRASNPUTER */
}
value = timer.state;
switch(state)
@@ -501,27 +454,6 @@ extern VOIDFUNC timer_wait FUNCARGVOID
{
int point;
-#ifdef TRANSPUTER
- /*{{{ wait for it*/
- {
- tick_t now;
-
- gettick(&now);
- if(timeafter(now, timer.timeout))
- {
- point = 1;
- timer.timeout = now;
- timer.missed++;
- }
- else
- {
- point = -1;
- ProcAfter(timer.timeout);
- }
- timer.timeout = tickadd(timer.timeout, timer.delay);
- }
- /*}}}*/
-#else
{
MASK mask;
@@ -585,7 +517,6 @@ extern VOIDFUNC timer_wait FUNCARGVOID
}
/*}}}*/
#endif /* BUSYWAIT */
-#endif /* TRANSPUTER */
if(timer.state != TIMING_ON)
/* EMPTY */;
else if(!timer.count)
@@ -603,7 +534,6 @@ extern VOIDFUNC timer_wait FUNCARGVOID
usec = (unsigned long)tickdelta(timer.stop, timer.start) * TICKTIME;
dilation = (unsigned)(usec / FRAME_RATIO_UPDATE *
FRAME_SCALE / timer.usec);
-#ifndef TRANSPUTER
#ifdef BUSYWAIT
if(!timer.busywait && dilation * 100 < FRAME_SCALE * 97)
{
@@ -613,7 +543,6 @@ extern VOIDFUNC timer_wait FUNCARGVOID
timer.busywait = 1;
}
#endif /* BUSYWAIT */
-#endif /* TRANSPUTER */
if(dilation <= FRAME_SCALE)
dilation = FRAME_SCALE;
else if(timer.missed <= (global.dilation == FRAME_SCALE ?
diff --git a/xmris.c b/xmris.c
index 2f6cc62..d79815a 100644
--- a/xmris.c
+++ b/xmris.c
@@ -1260,13 +1260,11 @@ ARGSEP char CONST **argv
Atom wm_delete_window;
myname = *argv ? *argv : "Xmris";
-#ifndef TRANSPUTER
real_uid = getuid();
effective_uid = geteuid();
if(real_uid != effective_uid)
set_euid(real_uid);
current_uid = real_uid;
-#endif /* TRANSPUTER */
open_toolkit(argc, (String *)argv);
init_scores();
/*{{{ help?*/
diff --git a/xmris.h b/xmris.h
index ac4fd50..9918502 100644
--- a/xmris.h
+++ b/xmris.h
@@ -13,25 +13,17 @@
#define FUNCANIMATE(name, arg) PROTOVOID(*name(arg)) PROTOVOID(*arg);
#endif
/*}}}*/
-#ifdef TRANSPUTER
-#undef USELOCKFILE
-#define USELOCKFILE
-#endif /* TRANSPUTER */
/*{{{ check score*/
#ifndef SCORE_DIR
#error No default score directory
#endif /* SCORE_DIR */
/*}}}*/
/*{{{ set_euid*/
-#ifdef TRANSPUTER
-typedef int uid_t;
-#else
#ifdef __hpux
#define set_euid(euid) setresuid((uid_t)-1, euid, (uid_t)-1)
#else
#define set_euid(euid) seteuid(euid)
#endif /* __hpux */
-#endif /* TRANSPUTER */
/*}}}*/
/*{{{ defines*/
/*{{{ board sizes*/
@@ -564,9 +556,6 @@ extern VOIDFUNC high_score PROTOARG((unsigned long, unsigned, unsigned long));
extern VOIDFUNC init_scores PROTOARG((VOIDARG));
/*}}}*/
/*{{{ timer*/
-#ifdef TRANSPUTER
-extern VOIDFUNC sleep PROTOARG((unsigned));
-#endif /* TRANSPUTER */
extern VOIDFUNC timer_close PROTOARG((VOIDARG));
extern VOIDFUNC timer_open PROTOARG((VOIDARG));
extern unsigned timer_set PROTOARG((unsigned long, unsigned));
--
1.7.5
0010-Remove-USELOCKFILE-stuff.patch:
Imakefile | 5 --
Makefile.std | 5 --
scoring.c | 102 -----------------------------------------------------------
xmris.man | 15 --------
4 files changed, 3 insertions(+), 124 deletions(-)
--- NEW FILE 0010-Remove-USELOCKFILE-stuff.patch ---
>From 4f1962e509a1338bd607937b6e55f9a82023d6ba Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Fri, 29 Apr 2011 17:19:05 +0200
Subject: [PATCH 10/20] Remove USELOCKFILE stuff
Removing this is a preparation step for cleaning up the highscore
support for dropping setgid rights directly on start, rather then using
unsafe seteg/uid tricks. In this mode using a separate lockfile is not
supported.
---
Imakefile | 5 +--
Makefile.std | 5 +--
scoring.c | 102 ----------------------------------------------------------
xmris.man | 14 +-------
4 files changed, 3 insertions(+), 123 deletions(-)
diff --git a/Imakefile b/Imakefile
index a6c6842..ad062d7 100644
--- a/Imakefile
+++ b/Imakefile
@@ -59,9 +59,6 @@ XCOMM
XCOMM don't you have gettimeofday?
TIME =
XCOMM TIME = -DUSETIME
-XCOMM don't you have lockf or flock?
-LOCK =
-XCOMM LOCK = -DUSELOCKFILE
XCOMM game defaults, you probably only want to alter the SCORE
XCOMM
@@ -121,7 +118,7 @@ FONT = thefont
#endif
DEFINES = $(EXTRACCOPTIONS) -DFONT_NAME='$(FONT)' $(NDEBUG) \
- -DSCORE_DIR='"$(SCORE)"' $(LOCK) $(TIME) $(KNR) -DSCROLLBARBUGFIX
+ -DSCORE_DIR='"$(SCORE)"' $(TIME) $(KNR) -DSCROLLBARBUGFIX
LOCAL_LIBRARIES = $(XAWLIB) $(XTOOLLIB) $(XMULIB) $(XINTL) $(XLIB) $(MATHSLIB)
DEPLIBS = $(DEPXLIB)
diff --git a/Makefile.std b/Makefile.std
index 72d1ba9..39b8935 100644
--- a/Makefile.std
+++ b/Makefile.std
@@ -434,9 +434,6 @@ KNR =
# don't you have gettimeofday?
TIME =
# TIME = -DUSETIME
-# don't you have lockf or flock?
-LOCK =
-LOCK = -DUSELOCKFILE
# game defaults, you probably only want to alter the SCORE
#
@@ -488,7 +485,7 @@ COFLAGS = -l
RCSFLAGS =
DEFINES = $(EXTRACCOPTIONS) -DFONT_NAME='$(FONT)' $(NDEBUG) \
- -DSCORE_DIR='"$(SCORE)"' $(LOCK) $(TIME) $(KNR) -DSCROLLBARBUGFIX
+ -DSCORE_DIR='"$(SCORE)"' $(TIME) $(KNR) -DSCROLLBARBUGFIX
LOCAL_LIBRARIES = $(XAWLIB) $(XTOOLLIB) $(XMULIB) $(XLIB) $(MATHSLIB)
DEPLIBS = $(DEPXLIB)
diff --git a/scoring.c b/scoring.c
index b63c2b6..015dd43 100644
--- a/scoring.c
+++ b/scoring.c
@@ -1,36 +1,8 @@
/* Copyright (C) 1993, 1992 Nathan Sidwell */
-/* RCS $Id: scoring.c 1.2 Tue, 16 Mar 1999 11:28:16 +0000 nathan $ */
-/*{{{ file locking problems*/
-/*
- * USELOCKFILE file locking as suggested by
- * Daniel Edward Lovinger <del+(a)cmu.edu>
- * With lockf (or flock), we just use the kernel's locking stuff to lock the
- * entire score file while we read, or update it. But some distributed
- * file systems don't support it and some are broken (SunOS 4.1).
- * USELOCKFILE uses uses open(O_CREAT | O_EXCL) to create
- * a lock file in the same directory as the xmris high score file, with
- * the name "xmris.lock".
- * The personal score files are either in the score file directory
- * with names "xmris-<name>", or in the user's home directory with name
- * ".xmris.scores".
- * In order to work correctly, if xmris is set_euid'd to get the access
- * permissions to the high score directory, we keep juggling
- * the effective user id between the set_euid'd one and the real uid.
- * This ensures that xmris can open the display on servers which use
- * magic cookie and access control (like openwindows), and that the
- * personal file has the correct attributes when created in the user's
- * home directory.
- *
- * Some systems have flock (BSD), and some have lockf (SYSV).
- */
-/*}}}*/
#include "xmris.h"
/*{{{ other includes*/
#include <pwd.h>
#include <sys/stat.h>
-#ifdef USELOCKFILE
-#include <fcntl.h>
-#endif /* USELOCKFILE */
/*}}}*/
/*{{{ file locking*/
#ifndef SYSV
@@ -53,10 +25,6 @@ static int personal_make = 2;
static uid_t personal_uid = -1; /* uid for personal file */
static char date_format[4] = " ";
static char *alternate = NULL; /* alternative name */
-#ifdef USELOCKFILE
-static char *locking_file = NULL; /* lock file name */
-static unsigned locks; /* number of locks open */
-#endif /* USELOCKFILE */
static HIGH_SCORE *CONST tables[] =
{scoring.high, scoring.today, scoring.personal};
/*}}}*/
@@ -164,54 +132,11 @@ ARGSEP uid_t uid
{
FILE *stream;
-#ifdef USELOCKFILE
- if(locking_file && !locks)
- /*{{{ attempt exclusive file lock*/
- {
- unsigned count;
- int filed;
-
- for(count = 3; count;)
- {
- if(current_uid != effective_uid)
- set_euid((current_uid = effective_uid));
- filed = open(locking_file, O_CREAT | O_EXCL, 0666);
- if(filed >= 0)
- break;
- if(errno == EINTR)
- continue;
- else if(errno == EEXIST)
- {
- sleep(1);
- if(!file_changed(name, uid))
- count--;
- }
- else
- {
- perror(locking_file);
- break;
- }
- }
- if(filed >= 0)
- close(filed);
- }
- /*}}}*/
-#endif /* USELOCKFILE */
if(uid != current_uid)
set_euid((current_uid = uid));
stream = fopen(name, flag & 1 ? "w+" : "r+");
if(!stream && !(flag & 2))
perror(name);
-#ifdef USELOCKFILE
- if(stream)
- locks++;
- else if(locking_file && !locks)
- {
- if(current_uid != effective_uid)
- set_euid((current_uid = effective_uid));
- unlink(locking_file);
- }
-#else
if(stream)
/*{{{ get lock on the file*/
while(lock_file(stream))
@@ -220,7 +145,6 @@ ARGSEP uid_t uid
continue;
}
/*}}}*/
-#endif /* USELOCKFILE */
if(stream && flag & 4 && effective_uid == real_uid)
chmod(name, 0666); /* not everyone has fchmod */
if(current_uid != real_uid)
@@ -238,22 +162,9 @@ FUNCARG((stream),
*/
{
fflush(stream);
-#ifdef USELOCKFILE
- fclose(stream);
- locks--;
- if(locking_file && locks)
- {
- if(current_uid != effective_uid)
- set_euid((current_uid = effective_uid));
- unlink(locking_file);
- if(current_uid != real_uid)
- set_euid((current_uid = real_uid));
- }
-#else
rewind(stream);
unlock_file(stream);
fclose(stream);
-#endif /* USELOCKFILE */
return;
}
/*}}}*/
@@ -394,19 +305,6 @@ extern VOIDFUNC init_scores FUNCARGVOID
dirlen = data.dir ? strlen(data.dir) : 0;
if(dirlen && data.dir[dirlen - 1] == '/')
dirlen--;
-#ifdef USELOCKFILE
- /*{{{ lock file?*/
- if(dirlen)
- {
- locking_file = malloc(dirlen + 12);
- if(locking_file)
- {
- strcpy(locking_file, data.dir);
- strcpy(&locking_file[dirlen], "/xmris.lock");
- }
- }
- /*}}}*/
-#endif /* USELOCKFILE */
/*{{{ score directory?*/
if(dirlen)
{
diff --git a/xmris.man b/xmris.man
index 1e7c47f..fab41d3 100644
--- a/xmris.man
+++ b/xmris.man
@@ -866,14 +866,6 @@ file to 666 if creating it.
.br
.ne 3
.TP
-.B .../xmris.lock
-In some systems, where lockf or flock doesn't work, this temporary file
-is used to perform the locking. The directory containing it must be
-writable by Mr Is. This can be done by chmoding the directory, or
-by setuiding Mr Is appropriately.
-.br
-.ne 4
-.TP
.PD 0
.B .../xmris-<name>
.TP
@@ -888,7 +880,7 @@ to move it to the score directory. Mr Is
will attempt to create the personal files in the score directory. If this
cannot be done, the personal score file is placed in the home directory. In
order to create the personal score file in the score directory, Mr Is will
-have to have the correct access rights, as with the lock file. A setuid Mr Is
+have to have the correct access rights. A setuid Mr Is
will juggle the effective uid correctly for accessing both the score directory
and the users' home directories.
.br
@@ -923,10 +915,6 @@ Some of the garden files.
.BR xmred (6)
.SH ERRORS
.PP
-If you use a lock file, rather than lockf, and an error occurs
-creating the lock file, a message is printed on stderr, and file
-locking is not done for that access. Subsequent accesses may be alright.
-.PP
If an error occurs opening the score file, a message is printed on
stderr, and the score file is disabled. Personal score files will
be generated in the users' home directories.
--
1.7.5
0011-Remove-seteuid-stuff.patch:
scoring.c | 60 ++++++++++++++++++++++--------------------------------------
xmris.c | 5 -----
xmris.h | 10 ----------
xmris.man | 20 +++++---------------
4 files changed, 27 insertions(+), 68 deletions(-)
--- NEW FILE 0011-Remove-seteuid-stuff.patch ---
>From da2715a3b82134d118b032a1db06881d128b564b Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Fri, 29 Apr 2011 17:52:33 +0200
Subject: [PATCH 11/20] Remove seteuid stuff
Removing this is a preparation step for cleaning up the highscore
support for dropping setgid rights directly on start, rather then using
unsafe seteg/uid tricks.
---
scoring.c | 60 ++++++++++++++++++++++--------------------------------------
xmris.c | 5 -----
xmris.h | 10 ----------
xmris.man | 19 +++++--------------
4 files changed, 27 insertions(+), 67 deletions(-)
diff --git a/scoring.c b/scoring.c
index 015dd43..ede2f07 100644
--- a/scoring.c
+++ b/scoring.c
@@ -22,7 +22,6 @@ static char *score_file = NULL; /* high score file name */
static char *personal_file = NULL; /* personal in high score dir */
static char *personal_home = NULL; /* personal in home dir */
static int personal_make = 2;
-static uid_t personal_uid = -1; /* uid for personal file */
static char date_format[4] = " ";
static char *alternate = NULL; /* alternative name */
static HIGH_SCORE *CONST tables[] =
@@ -30,8 +29,8 @@ static HIGH_SCORE *CONST tables[] =
/*}}}*/
/*{{{ prototypes*/
static unsigned expire PROTOARG((time_t, time_t));
-static unsigned file_changed PROTOARG((char CONST *, uid_t));
-static FILE *get_lock PROTOARG((char CONST *, unsigned, uid_t));
+static unsigned file_changed PROTOARG((char CONST *));
+static FILE *get_lock PROTOARG((char CONST *, unsigned));
static VOIDFUNC get_unlock PROTOARG((FILE *));
static unsigned insert_personal PROTOARG((HIGH_SCORE CONST *));
static unsigned insert_score
@@ -53,9 +52,9 @@ static unsigned long write_table
extern VOIDFUNC check_scores FUNCARGVOID
{
retire_scores();
- if((score_file && file_changed(score_file, effective_uid)) ||
+ if((score_file && file_changed(score_file)) ||
(!personal_make && personal_file &&
- file_changed(personal_file, personal_uid)))
+ file_changed(personal_file)))
load_check_expire_insert(0);
return;
}
@@ -84,11 +83,10 @@ ARGSEP time_t then
then_hour >= 21 && now_hour < 12));
}
/*}}}*/
-/*{{{ void file_changed(name, uid)*/
+/*{{{ void file_changed(name)*/
static unsigned file_changed
-FUNCARG((name, uid),
+FUNCARG((name),
char CONST *name
-ARGSEP uid_t uid
)
/*
* check if a score file has been changed since last I looked,
@@ -100,8 +98,6 @@ ARGSEP uid_t uid
unsigned changed;
assert(name);
- if(uid != current_uid)
- set_euid((current_uid = uid));
if(!stat(name, &buffer))
{
changed = buffer.st_mtime != last_time[name == score_file];
@@ -109,31 +105,24 @@ ARGSEP uid_t uid
}
else
changed = 0;
- if(real_uid != current_uid)
- set_euid((current_uid = real_uid));
return changed;
}
/*}}}*/
-/*{{{ void get_lock(name, flag, uid)*/
+/*{{{ void get_lock(name, flag)*/
static FILE *get_lock
-FUNCARG((name, flag, uid),
+FUNCARG((name, flag),
char CONST *name
ARGSEP unsigned flag
-ARGSEP uid_t uid
)
/*
* open and locks a high score file
* flag & 1 == 0 -> "r+"
* flag & 1 != 0 -> "w+"
* flag & 2 inhibit error message
- * flag & 4 && effective_uid == real_uid set chmod 666
- * uid required to access
*/
{
FILE *stream;
- if(uid != current_uid)
- set_euid((current_uid = uid));
stream = fopen(name, flag & 1 ? "w+" : "r+");
if(!stream && !(flag & 2))
perror(name);
@@ -145,10 +134,6 @@ ARGSEP uid_t uid
continue;
}
/*}}}*/
- if(stream && flag & 4 && effective_uid == real_uid)
- chmod(name, 0666); /* not everyone has fchmod */
- if(current_uid != real_uid)
- set_euid((current_uid = real_uid));
return stream;
}
/*}}}*/
@@ -212,7 +197,7 @@ extern VOIDFUNC init_scores FUNCARGVOID
{
struct passwd *ptr;
- ptr = getpwuid(real_uid);
+ ptr = getpwuid(getuid());
if(ptr)
{
user = ptr->pw_name;
@@ -344,7 +329,6 @@ extern VOIDFUNC init_scores FUNCARGVOID
}
}
/*}}}*/
- personal_uid = effective_uid;
if(data.expire || data.format || data.remove)
data.scores = True;
load_check_expire_insert(0);
@@ -448,7 +432,7 @@ FUNCARG((insert),
/*{{{ score_file?*/
if(score_file)
{
- score_stream = get_lock(score_file, 2, effective_uid);
+ score_stream = get_lock(score_file, 2);
if(score_stream)
do_score = merge_scores(score_stream);
else
@@ -458,7 +442,7 @@ FUNCARG((insert),
/*{{{ personal_file?*/
if(personal_file)
{
- personal_stream = get_lock(personal_file, personal_make, personal_uid);
+ personal_stream = get_lock(personal_file, personal_make);
if(personal_stream)
{
personal_make = 0;
@@ -473,7 +457,7 @@ FUNCARG((insert),
/*{{{ personal_home?*/
if(personal_home)
{
- home_stream = get_lock(personal_home, 2, real_uid);
+ home_stream = get_lock(personal_home, 2);
if(home_stream)
{
merge_personal(home_stream);
@@ -482,7 +466,6 @@ FUNCARG((insert),
personal_file = personal_home;
personal_home = NULL;
personal_make = 0;
- personal_uid = real_uid;
}
else
do_personal = 1;
@@ -534,10 +517,12 @@ FUNCARG((insert),
}
/*}}}*/
/* expire person? */
- if(effective_uid != real_uid)
+ if(getuid() != 0)
{
- if(data.remove || data.format)
- fprintf(stderr, "Not owner");
+ if(data.remove)
+ fprintf(stderr, "Removing a person can only be done by root");
+ if(data.format)
+ fprintf(stderr, "Changing the date format can only be done by root");
data.remove = data.format = NULL;
}
else
@@ -1010,7 +995,7 @@ FUNCARG((insert),
{
if(!score_stream && score_file)
{
- score_stream = get_lock(score_file, 5, effective_uid);
+ score_stream = get_lock(score_file, 5);
if(!score_stream)
score_file = NULL;
}
@@ -1022,7 +1007,7 @@ FUNCARG((insert),
if(do_personal)
{
if(!personal_stream && score_stream && personal_file)
- personal_stream = get_lock(personal_file, 3, personal_uid);
+ personal_stream = get_lock(personal_file, 3);
if(personal_stream)
{
write_personal(personal_stream);
@@ -1033,12 +1018,11 @@ FUNCARG((insert),
else
{
if(!home_stream)
- home_stream = get_lock(personal_home, 1, real_uid);
+ home_stream = get_lock(personal_home, 1);
if(home_stream)
write_personal(home_stream);
else
personal_home = NULL;
- personal_uid = real_uid;
personal_file = personal_home;
personal_home = NULL;
}
@@ -1052,9 +1036,9 @@ FUNCARG((insert),
if(score_stream)
get_unlock(score_stream);
if(do_score && score_file)
- file_changed(score_file, effective_uid);
+ file_changed(score_file);
if(do_personal && personal_file)
- file_changed(personal_file, personal_uid);
+ file_changed(personal_file);
return;
}
/*}}}*/
diff --git a/xmris.c b/xmris.c
index d79815a..b1a0404 100644
--- a/xmris.c
+++ b/xmris.c
@@ -1260,11 +1260,6 @@ ARGSEP char CONST **argv
Atom wm_delete_window;
myname = *argv ? *argv : "Xmris";
- real_uid = getuid();
- effective_uid = geteuid();
- if(real_uid != effective_uid)
- set_euid(real_uid);
- current_uid = real_uid;
open_toolkit(argc, (String *)argv);
init_scores();
/*{{{ help?*/
diff --git a/xmris.h b/xmris.h
index 9918502..1802e87 100644
--- a/xmris.h
+++ b/xmris.h
@@ -18,13 +18,6 @@
#error No default score directory
#endif /* SCORE_DIR */
/*}}}*/
-/*{{{ set_euid*/
-#ifdef __hpux
-#define set_euid(euid) setresuid((uid_t)-1, euid, (uid_t)-1)
-#else
-#define set_euid(euid) seteuid(euid)
-#endif /* __hpux */
-/*}}}*/
/*{{{ defines*/
/*{{{ board sizes*/
#define KNOCK_THROUGH /* how far we go to knock through a new cell */\
@@ -355,9 +348,6 @@ EXTERN struct
unsigned pressed; /* keys we had pressed */
} player;
/*}}}*/
-EXTERN uid_t real_uid; /* who I really am */
-EXTERN uid_t effective_uid; /* who I'm pretending to be */
-EXTERN uid_t current_uid; /* who I currently am */
EXTERN CELL garden[(CELLS_DOWN + CELL_TOP * 2) * CELL_STRIDE];
/*{{{ global*/
EXTERN struct
diff --git a/xmris.man b/xmris.man
index fab41d3..3fe5028 100644
--- a/xmris.man
+++ b/xmris.man
@@ -277,13 +277,9 @@ to use the -dir option too.
.ne 3
.TP
.B \-remove \fIname\fP
-Allows the game's owner to remove someone's scores. The option will only
-work when the real and effective user ids are the same. (ie
-a setuid Mr Is has been run by its owner). After updating the files,
+Allows root to remove someone's scores. After updating the files,
the score tables are listed, and the game does not start. An X display
-will still need to be opened, to read the X resources, which may override
-the default score directory. The +display option may be used to prevent
-this.
+will still be opened. The +display option may be used to prevent this.
.br
.ne 3
.TP
@@ -324,7 +320,7 @@ and a warning is given. The following are valid unambiguous dates, '11jun93'
.ne 3
.TP
.B \-format \fIformat\fP
-Allows the game's owner to set the date format which is stored with the
+Allows root to set the date format which is stored with the
score file, for future use disambiguating dates. The format is
automatically stored if none is set. The format must be a three character
string containing one each of 'D', 'M' and 'Y'.
@@ -859,10 +855,7 @@ following names.
The high score file. The directory is system dependent, and may be
changed by application resource or option.
This file must either exist and be writable to by Mr Is, or the
-directory containing it must be writable by Mr Is. This
-can be done by chmoding the score file or directory, or by
-setuiding Mr Is appropriately. A non-setuid Mr Is will chmod the score
-file to 666 if creating it.
+directory containing it must be writable by Mr Is.
.br
.ne 3
.TP
@@ -880,9 +873,7 @@ to move it to the score directory. Mr Is
will attempt to create the personal files in the score directory. If this
cannot be done, the personal score file is placed in the home directory. In
order to create the personal score file in the score directory, Mr Is will
-have to have the correct access rights. A setuid Mr Is
-will juggle the effective uid correctly for accessing both the score directory
-and the users' home directories.
+have to have the correct access rights.
.br
.ne 5
.TP
--
1.7.5
0012-Drop-dir-option.patch:
Imakefile | 33 +++------------------------------
Makefile.std | 35 +++--------------------------------
README | 10 ----------
Xmris-ad.src | 1 -
common.h | 1 -
defcom.c | 5 -----
draw.c | 4 ----
makemris.c | 6 ------
scoring.c | 15 ++++++---------
xmris.h | 8 --------
xmris.man | 29 +++++------------------------
11 files changed, 17 insertions(+), 130 deletions(-)
--- NEW FILE 0012-Drop-dir-option.patch ---
>From ff2baedb64e331b3a3742be72461d37307257c11 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Sat, 30 Apr 2011 12:43:03 +0200
Subject: [PATCH 12/20] Drop -dir option
Allowing the user to specify the directory in which files will be created
using elevated rights, seems like a bad idea.
---
Imakefile | 33 +++------------------------------
Makefile.std | 35 +++--------------------------------
README | 10 ----------
Xmris-ad.src | 1 -
common.h | 1 -
defcom.c | 5 -----
draw.c | 4 ----
makemris.c | 6 ------
scoring.c | 15 ++++++---------
xmris.h | 8 --------
xmris.man | 28 +++++-----------------------
11 files changed, 17 insertions(+), 129 deletions(-)
diff --git a/Imakefile b/Imakefile
index ad062d7..dcf93c8 100644
--- a/Imakefile
+++ b/Imakefile
@@ -60,13 +60,10 @@ XCOMM don't you have gettimeofday?
TIME =
XCOMM TIME = -DUSETIME
-XCOMM game defaults, you probably only want to alter the SCORE
+XCOMM game defaults, you probably do not want to alter these
XCOMM
/* You must specify a fixed width font that exists. */
/* #define thefont "-*-courier-*-r-*-*-18-*-*-*-m-*-*-*" */
-XCOMM where is the high score file?
-XCOMM SCORE = $(LOCAL)/lib/$(APP)
-SCORE = /var/games/$(APP)
/* to install default gardens not in /usr/share/$(APP) */
/* #define InstallDefaultGardens $(DESTDIR)/usr/share/$(APP) */
@@ -90,14 +87,10 @@ XCOMM owner and access rights for executable & score directory
XCOMM these are set for a setuid xmris
XCOMM OWNER = -o games
OWNER =
-INSTSCOREFLAGS = $(OWNER) -m 755
INSTMRISFLAGS = $(OWNER) $(INSTUIDFLAGS)
XCOMM normal install locations
THEBINDIR = $(BINDIR)
THEMANDIR = $(MANDIR)
-XCOMM for open access you want 777 and $(INSTPGMFLAGS),
-XCOMM (the personal score files go in users' home dirs.)
-XCOMM INSTSCOREFLAGS = -m 777
XCOMM INSTMRISFLAGS = $(INSTPGMFLAGS)
XCOMM If you're not installing in the default locations
XCOMM DESTDIR =
@@ -118,7 +111,7 @@ FONT = thefont
#endif
DEFINES = $(EXTRACCOPTIONS) -DFONT_NAME='$(FONT)' $(NDEBUG) \
- -DSCORE_DIR='"$(SCORE)"' $(TIME) $(KNR) -DSCROLLBARBUGFIX
+ $(TIME) $(KNR) -DSCROLLBARBUGFIX
LOCAL_LIBRARIES = $(XAWLIB) $(XTOOLLIB) $(XMULIB) $(XINTL) $(XLIB) $(MATHSLIB)
DEPLIBS = $(DEPXLIB)
@@ -260,24 +253,7 @@ XCOMM application resource files
InstallAppDefaults(Xmris)
Xmris.ad : Xmris-ad.src
- sed -e 's@SCORE@$(SCORE)@' -e s@FONT@$(FONT)@ < Xmris-ad.src > Xmris.ad
-
-XCOMM score directory install
-install ::
- MakeDir($(SCORE))
- @#not all $(INSTALL) have a -d flag, have to do it explicitly
- @echo installing $(INSTSCOREFLAGS) $(SCORE)
- @set -- $(INSTSCOREFLAGS) ; \
- while [ $$# -ne 0 ] ; \
- do \
- case "$$1" in \
- "-o") shift ; chown $$1 $(SCORE) ; echo owner is $$1 ;; \
- "-m") shift ; chmod $$1 $(SCORE) ;; \
- "-g") shift ; chgrp $$1 $(SCORE) ; echo group is $$1 ;; \
- *) echo unknown option '$$1' ;; \
- esac ; \
- shift ; \
- done
+ sed -e s@FONT@$(FONT)@ < Xmris-ad.src > Xmris.ad
#ifdef InstallDefaultGardens
XCOMM install default gardens
@@ -848,9 +824,6 @@ initialize :
@if [ `ls -t Makefile Imakefile | sed '2,$$d'` = Imakefile ] ; then \
echo Warning:Makefile is older than Imakefile ; \
fi
- @if [ ! -d `echo '$(SCORE)' | sed 's=/[^/]*$$=='` ] ; then \
- echo The parent of $(SCORE) does not exist ; \
- fi
@if [ $(FONT) = "" ] ; then true ; \
elif echo $(FONT) | grep -c -- '-m-.*-.*-.*$$' > /dev/null ; then \
if [ "$(XLSFONTS)" = "" -o "$(DISPLAY)" = "" ] ; then \
diff --git a/Makefile.std b/Makefile.std
index 39b8935..84fdd8e 100644
--- a/Makefile.std
+++ b/Makefile.std
@@ -435,13 +435,9 @@ KNR =
TIME =
# TIME = -DUSETIME
-# game defaults, you probably only want to alter the SCORE
+# game defaults, you probably do not want to alter these
#
-# where is the high score file?
-# SCORE = $(LOCAL)/lib/$(APP)
-SCORE = $(LIBDIR)/$(APP)
-
# The following defines are needed for some implementations and/or sites.
# It is xmkmf's job to get these right in the first place.
# If you have to declare any of these, X may not be installed correctly.
@@ -462,14 +458,10 @@ SCORE = $(LIBDIR)/$(APP)
# owner and access rights for executable & score directory
# these are set for a setuid xmris
OWNER = -o games
-INSTSCOREFLAGS = $(OWNER) -m 755
INSTMRISFLAGS = $(OWNER) $(INSTUIDFLAGS)
# normal install locations
THEBINDIR = $(BINDIR)
THEMANDIR = $(MANDIR)
-# for open access you want 777 and $(INSTPGMFLAGS),
-# (the personal score files go in users' home dirs.)
-# INSTSCOREFLAGS = -m 777
# INSTMRISFLAGS = $(INSTPGMFLAGS)
# If you're not installing in the default locations
# DESTDIR =
@@ -485,7 +477,7 @@ COFLAGS = -l
RCSFLAGS =
DEFINES = $(EXTRACCOPTIONS) -DFONT_NAME='$(FONT)' $(NDEBUG) \
- -DSCORE_DIR='"$(SCORE)"' $(TIME) $(KNR) -DSCROLLBARBUGFIX
+ $(TIME) $(KNR) -DSCROLLBARBUGFIX
LOCAL_LIBRARIES = $(XAWLIB) $(XTOOLLIB) $(XMULIB) $(XLIB) $(MATHSLIB)
DEPLIBS = $(DEPXLIB)
@@ -665,25 +657,7 @@ install:: Xmris.ad
$(INSTALL) $(INSTALLFLAGS) $(INSTAPPFLAGS) Xmris.ad $(DESTDIR)$(XAPPLOADDIR)/Xmris
Xmris.ad : Xmris-ad.src
- sed -e 's@SCORE@$(SCORE)@' -e s@FONT@$(FONT)@ < Xmris-ad.src > Xmris.ad
-
-# score directory install
-install ::
- @if [ -d $(SCORE) ]; then set +x; \
- else (set -x; $(MKDIRHIER) $(SCORE)); fi
- @#not all $(INSTALL) have a -d flag, have to do it explicitly
- @echo installing $(INSTSCOREFLAGS) $(SCORE)
- @set -- $(INSTSCOREFLAGS) ; \
- while [ $$# -ne 0 ] ; \
- do \
- case "$$1" in \
- "-o") shift ; chown $$1 $(SCORE) ; echo owner is $$1 ;; \
- "-m") shift ; chmod $$1 $(SCORE) ;; \
- "-g") shift ; chgrp $$1 $(SCORE) ; echo group is $$1 ;; \
- *) echo unknown option '$$1' ;; \
- esac ; \
- shift ; \
- done
+ sed -e s@FONT@$(FONT)@ < Xmris-ad.src > Xmris.ad
# install default gardens
install :: $(GARDENS)
@@ -1257,9 +1231,6 @@ initialize :
@if [ `ls -t Makefile Imakefile | sed '2,$$d'` = Imakefile ] ; then \
echo Warning:Makefile is older than Imakefile ; \
fi
- @if [ ! -d `echo '$(SCORE)' | sed 's=/[^/]*$$=='` ] ; then \
- echo The parent of $(SCORE) does not exist ; \
- fi
@if [ $(FONT) = "" ] ; then true ; \
elif echo $(FONT) | grep -c -- '-m-.*-.*-.*$$' > /dev/null ; then \
if [ "$(XLSFONTS)" = "" -o "$(DISPLAY)" = "" ] ; then \
diff --git a/README b/README
index f6c80b0..58dc90a 100644
--- a/README
+++ b/README
@@ -29,16 +29,6 @@ the define USETIME, this will give less accurate timing. Also
gettimeofday may or may not need a timezone argument, this is checked
by the system type in timer.c.
-Set SCORE to the name of the high score directory.
-The score file uses lockf or flock by default, this doesn't work
-on some distributed filing systems. If so,
-define USELOCKFILE, and a lock file is used to do the locking with
-open(O_CREAT | O_EXCL). The name of the lock file is xmris.lock.
-For this to work the high score directory must be writeable, which
-is not the case with lockf. Personal high score files are also put
-in this directory, if xmris can create them there, otherwise they
-will be put in the users' home directory.
-
You may need to force static linking, and not use shared libraries, or
store a library load path with the binary with the linker -R option.
The EXTRA_LOAD_FLAGS can be used for this. (This may be necessary for
diff --git a/Xmris-ad.src b/Xmris-ad.src
index 60be0ac..6368076 100644
--- a/Xmris-ad.src
+++ b/Xmris-ad.src
@@ -13,7 +13,6 @@
*Quit: q
*Iconize: i
*Keyboard: k
-*Dir: SCORE
*ReverseVideo: no
*Monochrome: no
*Gender: he
diff --git a/common.h b/common.h
index 0babbce..b146a47 100644
--- a/common.h
+++ b/common.h
@@ -280,7 +280,6 @@ typedef struct Data
{
Font font; /* font to use */
#ifndef XMRED
- String dir; /* score directory */
String expire; /* expiration */
String remove; /* removal */
String boards; /* board definitions */
diff --git a/defcom.c b/defcom.c
index 9715fe9..1c63cbc 100644
--- a/defcom.c
+++ b/defcom.c
@@ -193,7 +193,6 @@ CommandOptionDesc command_options[] =
{"-remove", 1, XtOffsetOf(DATA, remove)},
{"-nodisplay",0, XtOffsetOf(DATA, nodisplay)},
{"+display", 0, XtOffsetOf(DATA, nodisplay)},
- {"-dir", 1, XtOffsetOf(DATA, dir)},
#endif /* XMRED */
{NULL}
};
@@ -228,9 +227,6 @@ XrmOptionDescRec options[] =
XtResource resources[] =
{
#ifndef XMRED
- /* dir must be first */
- {"dir", "Dir", XtRString, sizeof(String),
- XtOffsetOf(DATA, dir), XtRString, (XtPointer)SCORE_DIR},
{"up", "Up", XtRKeySym, sizeof(KeySym),
XtOffsetOf(DATA, keysyms[0]), XtRString, (XtPointer)"Up"},
{"down", "Down", XtRKeySym, sizeof(KeySym),
@@ -371,7 +367,6 @@ HELP CONST help[] =
{"Modern sprites", "-msit", "Gender:she", ""},
#ifndef XMRED
{"Random apples", "-random", "Random:yes", ""},
- {"High score directory", "-dir", "Dir:", "<directory>"},
{"Use username in score", "-username", "UserName:yes", ""},
{"Use realname in score", "-realname", "UserName:no", ""},
#endif /* XMRED */
diff --git a/draw.c b/draw.c
index ea0f65d..fcf5401 100644
--- a/draw.c
+++ b/draw.c
@@ -1039,10 +1039,6 @@ ARGSEP char CONST *parent
if(!lib)
lib = XtResolvePathname(display.display, "app-defaults/xmris",
name, FILE_SUFFIX, NULL, NULL, 0, NULL);
- if(!lib && data.dir)
- lib = XtResolvePathname(display.display, data.dir, name,
- FILE_SUFFIX, "%T/%N:%T/%N%S:%T/gardens/%N:%T/gardens/%N%S",
- NULL, 0, NULL);
if(lib)
{
XtFree(filename);
diff --git a/makemris.c b/makemris.c
index 4bf8d20..95046d7 100644
--- a/makemris.c
+++ b/makemris.c
@@ -309,7 +309,6 @@ ARGSEP String *argv
/*{{{ some more setup*/
{
XtResource CONST *ptr;
- char *dir;
XtAppSetTypeConverter(display.context, XtRString, XtRKeySym,
convert_string2keysym, (XtConvertArgRec *)NULL, 0, XtCacheNone,
@@ -320,13 +319,10 @@ ARGSEP String *argv
(void (*)PROTOARG((XtAppContext, XrmValue *, XtPointer,
XrmValue *, Cardinal *)))NULL);
display.display = XtDisplay(display.toplevel);
- dir = data.dir;
for(ptr = resources; *(char CONST **)ptr; ptr++)
/* EMPTY */;
XtGetApplicationResources(display.toplevel, (XtPointer)&data,
resources, (Cardinal)(ptr - resources), (Arg *)NULL, 0);
- if(dir)
- data.dir = dir;
gettoplevelresources();
XtVaSetValues(display.toplevel,
XtNtitle, (XtArgVal)names[data.gender != False],
@@ -340,8 +336,6 @@ ARGSEP String *argv
}
}
/*}}}*/
- if(!data.dir)
- data.dir = (char *)resources[0].default_addr;
}
/*}}}*/
return;
diff --git a/scoring.c b/scoring.c
index ede2f07..2e93b30 100644
--- a/scoring.c
+++ b/scoring.c
@@ -17,6 +17,7 @@
#endif /* SYSV */
/*}}}*/
/*{{{ static*/
+static CONST char *score_dir = "/var/games";
static CONST char date_formats[4] = "DMY";
static char *score_file = NULL; /* high score file name */
static char *personal_file = NULL; /* personal in high score dir */
@@ -287,25 +288,22 @@ extern VOIDFUNC init_scores FUNCARGVOID
scoring.alternate = alternate;
}
/*}}}*/
- dirlen = data.dir ? strlen(data.dir) : 0;
- if(dirlen && data.dir[dirlen - 1] == '/')
- dirlen--;
/*{{{ score directory?*/
- if(dirlen)
{
size_t nlen;
+ dirlen = strlen(score_dir);
score_file = malloc(dirlen + 14);
if(score_file)
{
- strcpy(score_file, data.dir);
+ strcpy(score_file, score_dir);
strcpy(&score_file[dirlen], "/xmris.score");
}
nlen = strlen(user);
personal_file = malloc(dirlen + 8 + nlen);
if(personal_file)
{
- strcpy(personal_file, data.dir);
+ strcpy(personal_file, score_dir);
strcpy(&personal_file[dirlen], "/xmris-");
strcpy(&personal_file[dirlen + 7], user);
}
@@ -591,16 +589,15 @@ FUNCARG((insert),
/*{{{ try personal files too*/
{
/*{{{ score directory?*/
- if(data.dir)
{
size_t dirlen;
char *file;
- dirlen = strlen(data.dir);
+ dirlen = strlen(score_dir);
file = malloc(dirlen + 8 + strlen(data.remove));
if(file)
{
- strcpy(file, data.dir);
+ strcpy(file, score_dir);
strcpy(&file[dirlen], "/xmris-");
strcpy(&file[dirlen + 7], data.remove);
if(!unlink(file))
diff --git a/xmris.h b/xmris.h
index 1802e87..1e696c5 100644
--- a/xmris.h
+++ b/xmris.h
@@ -13,11 +13,6 @@
#define FUNCANIMATE(name, arg) PROTOVOID(*name(arg)) PROTOVOID(*arg);
#endif
/*}}}*/
-/*{{{ check score*/
-#ifndef SCORE_DIR
- #error No default score directory
-#endif /* SCORE_DIR */
-/*}}}*/
/*{{{ defines*/
/*{{{ board sizes*/
#define KNOCK_THROUGH /* how far we go to knock through a new cell */\
@@ -41,9 +36,6 @@
#define SCORE_SCALE 1024 /* precision of score scaling */
/*}}}*/
/*{{{ score file*/
-#ifndef SCORE_DIR
-#define SCORE_DIR NULL
-#endif /* SCORE_DIR */
#define SCORE_THRESHOLD 10000 /* minimum score for fame */
#define SCORE_ROUND 5 /* scores are rounded */
#define HIGH_SCORES (CELLS_DOWN - 2)
diff --git a/xmris.man b/xmris.man
index 3fe5028..f108e24 100644
--- a/xmris.man
+++ b/xmris.man
@@ -231,17 +231,12 @@ is still being used for the initial part of the frame delay.
.br
.ne 3
.TP
-.B \-dir \fIscore-directory\fP
-Specify a different score directory.
-.br
-.ne 4
-.TP
.PD 0
.B \-username
.TP
.B \-realname
.PD
-The name for the score file can be either the username or the real name.
+The name inside the score file can be either the username or the real name.
These options select which to use. The default is to use the real name.
If the real name is unobtainable, the username will
be used anyway. If the current score file has an entry by the other
@@ -257,10 +252,8 @@ the Mr Is subdirectory of app-defaults. These are explained below.
.ne 3
.TP
.B \-scores
-List the high scores to stdout. Does not start the game. Note that this
-will still need to open an X display, in order to read the X resources
-(which may affect the score directory). If you don't want the defaults
-read, use the +display option too.
+List the high scores to stdout. Does not start the game. An X display
+will still be opened. The +display option may be used to prevent this.
.br
.ne 4
.TP
@@ -422,11 +415,6 @@ sensitive.
.br
.ne 3
.TP
-.B Xmris.Dir: \fIscore-directory\fP
-The name of the high score directory.
-.br
-.ne 3
-.TP
.B Xmris.UserName: \fI{yes, no}\fP [no]
Selects whether the username or real name should be used for your entry
in the high score table.
@@ -851,9 +839,8 @@ following names.
.br
.ne 3
.TP
-.B .../xmris.score
-The high score file. The directory is system dependent, and may be
-changed by application resource or option.
+.B /var/games/xmris.score
+The high score file.
This file must either exist and be writable to by Mr Is, or the
directory containing it must be writable by Mr Is.
.br
@@ -888,12 +875,7 @@ See X for information about how these are searched.
.br
.ne 6
.TP
-.PD 0
.B .../app-defaults/xmris/<gardens>
-.TP
-.B <score-dir>/<gardens>
-.TP
-.B <score-dir>/gardens/<gardens>
.PD
Search path for loadable gardens. The suffix ".gdn" is appended to the
filename, if required.
--
1.7.5
0013-Drop-support-for-global-personal-file.patch:
scoring.c | 91 +++++---------------------------------------------------------
xmris.man | 15 ----------
2 files changed, 9 insertions(+), 97 deletions(-)
--- NEW FILE 0013-Drop-support-for-global-personal-file.patch ---
>From 256730c26c8369518d131d9b85a871907cf3f7bc Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Sat, 30 Apr 2011 16:09:45 +0200
Subject: [PATCH 13/20] Drop support for global personal file
Having it in $home works fine and having support for both just
needlessly complicates the code.
---
scoring.c | 91 +++++-------------------------------------------------------
xmris.man | 14 +---------
2 files changed, 9 insertions(+), 96 deletions(-)
diff --git a/scoring.c b/scoring.c
index 2e93b30..fd2cd77 100644
--- a/scoring.c
+++ b/scoring.c
@@ -20,9 +20,7 @@
static CONST char *score_dir = "/var/games";
static CONST char date_formats[4] = "DMY";
static char *score_file = NULL; /* high score file name */
-static char *personal_file = NULL; /* personal in high score dir */
static char *personal_home = NULL; /* personal in home dir */
-static int personal_make = 2;
static char date_format[4] = " ";
static char *alternate = NULL; /* alternative name */
static HIGH_SCORE *CONST tables[] =
@@ -54,8 +52,7 @@ extern VOIDFUNC check_scores FUNCARGVOID
{
retire_scores();
if((score_file && file_changed(score_file)) ||
- (!personal_make && personal_file &&
- file_changed(personal_file)))
+ (personal_home && file_changed(personal_home)))
load_check_expire_insert(0);
return;
}
@@ -290,8 +287,6 @@ extern VOIDFUNC init_scores FUNCARGVOID
/*}}}*/
/*{{{ score directory?*/
{
- size_t nlen;
-
dirlen = strlen(score_dir);
score_file = malloc(dirlen + 14);
if(score_file)
@@ -299,14 +294,6 @@ extern VOIDFUNC init_scores FUNCARGVOID
strcpy(score_file, score_dir);
strcpy(&score_file[dirlen], "/xmris.score");
}
- nlen = strlen(user);
- personal_file = malloc(dirlen + 8 + nlen);
- if(personal_file)
- {
- strcpy(personal_file, score_dir);
- strcpy(&personal_file[dirlen], "/xmris-");
- strcpy(&personal_file[dirlen + 7], user);
- }
}
/*}}}*/
/*{{{ personal file*/
@@ -421,11 +408,10 @@ FUNCARG((insert),
*/
{
FILE *score_stream;
- FILE *personal_stream;
FILE *home_stream;
unsigned do_score, do_personal;
- score_stream = personal_stream = home_stream = NULL;
+ score_stream = home_stream = NULL;
do_score = do_personal = 0;
/*{{{ score_file?*/
if(score_file)
@@ -437,37 +423,14 @@ FUNCARG((insert),
do_score = 1;
}
/*}}}*/
- /*{{{ personal_file?*/
- if(personal_file)
- {
- personal_stream = get_lock(personal_file, personal_make);
- if(personal_stream)
- {
- personal_make = 0;
- if(personal_home && !unlink(personal_home))
- fprintf(stderr, "Two personal score files, '%s' removed\n",
- personal_home);
- personal_home = NULL;
- do_personal = merge_personal(personal_stream);
- }
- }
- /*}}}*/
/*{{{ personal_home?*/
if(personal_home)
{
home_stream = get_lock(personal_home, 2);
if(home_stream)
- {
- merge_personal(home_stream);
- if(!personal_file)
- {
- personal_file = personal_home;
- personal_home = NULL;
- personal_make = 0;
- }
- else
- do_personal = 1;
- }
+ do_personal = merge_personal(home_stream);
+ else
+ do_personal = 1;
}
/*}}}*/
/*{{{ check alternate*/
@@ -588,27 +551,6 @@ FUNCARG((insert),
do_score |= found;
/*{{{ try personal files too*/
{
- /*{{{ score directory?*/
- {
- size_t dirlen;
- char *file;
-
- dirlen = strlen(score_dir);
- file = malloc(dirlen + 8 + strlen(data.remove));
- if(file)
- {
- strcpy(file, score_dir);
- strcpy(&file[dirlen], "/xmris-");
- strcpy(&file[dirlen + 7], data.remove);
- if(!unlink(file))
- {
- personal = 1;
- found = 1;
- }
- free(file);
- }
- }
- /*}}}*/
/*{{{ home directory?*/
{
if(home)
@@ -1003,39 +945,22 @@ FUNCARG((insert),
/*{{{ write personal?*/
if(do_personal)
{
- if(!personal_stream && score_stream && personal_file)
- personal_stream = get_lock(personal_file, 3);
- if(personal_stream)
- {
- write_personal(personal_stream);
- if(personal_home)
- unlink(personal_home);
- personal_home = NULL;
- }
- else
- {
if(!home_stream)
home_stream = get_lock(personal_home, 1);
if(home_stream)
write_personal(home_stream);
else
personal_home = NULL;
- personal_file = personal_home;
- personal_home = NULL;
- }
- personal_make = 0;
}
/*}}}*/
- if(personal_stream)
- get_unlock(personal_stream);
if(home_stream)
get_unlock(home_stream);
if(score_stream)
get_unlock(score_stream);
if(do_score && score_file)
file_changed(score_file);
- if(do_personal && personal_file)
- file_changed(personal_file);
+ if(do_personal && personal_home)
+ file_changed(personal_home);
return;
}
/*}}}*/
@@ -1103,7 +1028,7 @@ FUNCARG((stream),
if(failed)
{
fprintf(stderr, "%s:Your personal score file '%s' has been corrupted.\n",
- myname, personal_file);
+ myname, personal_home);
scoring.personal[0].score = 0;
}
return failed;
diff --git a/xmris.man b/xmris.man
index f108e24..ae881c0 100644
--- a/xmris.man
+++ b/xmris.man
@@ -846,21 +846,9 @@ directory containing it must be writable by Mr Is.
.br
.ne 3
.TP
-.PD 0
-.B .../xmris-<name>
-.TP
.B ~/.xmris.score
.PD
-One of these files is used to store the personal best scores.
-Mr Is first looks for the personal score file in the score directory and
-then in the home directory. If a personal
-score file cannot be found, Mr Is attempts to create one.
-If the file is found in the user's home directory, Mr Is attempts
-to move it to the score directory. Mr Is
-will attempt to create the personal files in the score directory. If this
-cannot be done, the personal score file is placed in the home directory. In
-order to create the personal score file in the score directory, Mr Is will
-have to have the correct access rights.
+This file is used to store the personal best scores.
.br
.ne 5
.TP
--
1.7.5
0014-Some-renames.patch:
scoring.c | 47 +++++++++++++++++++++++------------------------
1 file changed, 23 insertions(+), 24 deletions(-)
--- NEW FILE 0014-Some-renames.patch ---
>From 5997920c77b25c8ed4a79f44da13436ad05412e5 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Sat, 30 Apr 2011 16:12:48 +0200
Subject: [PATCH 14/20] Some renames
Things make more sense after the previous commit with some vars renamed:
s/personal_home/personal_file/
s/home_stream/personal_stream/
---
scoring.c | 46 +++++++++++++++++++++++-----------------------
1 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/scoring.c b/scoring.c
index fd2cd77..72f08d6 100644
--- a/scoring.c
+++ b/scoring.c
@@ -20,7 +20,7 @@
static CONST char *score_dir = "/var/games";
static CONST char date_formats[4] = "DMY";
static char *score_file = NULL; /* high score file name */
-static char *personal_home = NULL; /* personal in home dir */
+static char *personal_file = NULL; /* personal in home dir */
static char date_format[4] = " ";
static char *alternate = NULL; /* alternative name */
static HIGH_SCORE *CONST tables[] =
@@ -52,7 +52,7 @@ extern VOIDFUNC check_scores FUNCARGVOID
{
retire_scores();
if((score_file && file_changed(score_file)) ||
- (personal_home && file_changed(personal_home)))
+ (personal_file && file_changed(personal_file)))
load_check_expire_insert(0);
return;
}
@@ -305,11 +305,11 @@ extern VOIDFUNC init_scores FUNCARGVOID
size_t length;
length = strlen(home);
- personal_home = malloc(length + 15);
- if(personal_home)
+ personal_file = malloc(length + 15);
+ if(personal_file)
{
- strcpy(personal_home, home);
- strcpy(&personal_home[length], "/.xmris.score");
+ strcpy(personal_file, home);
+ strcpy(&personal_file[length], "/.xmris.score");
}
}
}
@@ -408,10 +408,10 @@ FUNCARG((insert),
*/
{
FILE *score_stream;
- FILE *home_stream;
+ FILE *personal_stream;
unsigned do_score, do_personal;
- score_stream = home_stream = NULL;
+ score_stream = personal_stream = NULL;
do_score = do_personal = 0;
/*{{{ score_file?*/
if(score_file)
@@ -423,12 +423,12 @@ FUNCARG((insert),
do_score = 1;
}
/*}}}*/
- /*{{{ personal_home?*/
- if(personal_home)
+ /*{{{ personal_file?*/
+ if(personal_file)
{
- home_stream = get_lock(personal_home, 2);
- if(home_stream)
- do_personal = merge_personal(home_stream);
+ personal_stream = get_lock(personal_file, 2);
+ if(personal_stream)
+ do_personal = merge_personal(personal_stream);
else
do_personal = 1;
}
@@ -945,22 +945,22 @@ FUNCARG((insert),
/*{{{ write personal?*/
if(do_personal)
{
- if(!home_stream)
- home_stream = get_lock(personal_home, 1);
- if(home_stream)
- write_personal(home_stream);
+ if(!personal_stream)
+ personal_stream = get_lock(personal_file, 1);
+ if(personal_stream)
+ write_personal(personal_stream);
else
- personal_home = NULL;
+ personal_file = NULL;
}
/*}}}*/
- if(home_stream)
- get_unlock(home_stream);
+ if(personal_stream)
+ get_unlock(personal_stream);
if(score_stream)
get_unlock(score_stream);
if(do_score && score_file)
file_changed(score_file);
- if(do_personal && personal_home)
- file_changed(personal_home);
+ if(do_personal && personal_file)
+ file_changed(personal_file);
return;
}
/*}}}*/
@@ -1028,7 +1028,7 @@ FUNCARG((stream),
if(failed)
{
fprintf(stderr, "%s:Your personal score file '%s' has been corrupted.\n",
- myname, personal_home);
+ myname, personal_file);
scoring.personal[0].score = 0;
}
return failed;
--
1.7.5
0015-Open-score-files-only-once-and-keep-them-open-till-t.patch:
scoring.c | 151 ++++++++++++++++++++++++++++++--------------------------------
xmris.c | 1
xmris.h | 2
3 files changed, 76 insertions(+), 78 deletions(-)
--- NEW FILE 0015-Open-score-files-only-once-and-keep-them-open-till-t.patch ---
>From 1105d6f3df03ffe6f3bd26fc37f8daf092f920e5 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Sun, 1 May 2011 10:59:39 +0200
Subject: [PATCH 15/20] Open score files only once and keep them open till the
program exits
---
scoring.c | 151 ++++++++++++++++++++++++++++++-------------------------------
xmris.c | 1 +
xmris.h | 1 +
3 files changed, 76 insertions(+), 77 deletions(-)
diff --git a/scoring.c b/scoring.c
index 72f08d6..381057b 100644
--- a/scoring.c
+++ b/scoring.c
@@ -17,10 +17,11 @@
#endif /* SYSV */
/*}}}*/
/*{{{ static*/
-static CONST char *score_dir = "/var/games";
static CONST char date_formats[4] = "DMY";
-static char *score_file = NULL; /* high score file name */
+static char *score_file = "/var/games/xmris.score"; /* score file name */
static char *personal_file = NULL; /* personal in home dir */
+static FILE *score_stream = NULL;
+static FILE *personal_stream = NULL;
static char date_format[4] = " ";
static char *alternate = NULL; /* alternative name */
static HIGH_SCORE *CONST tables[] =
@@ -29,7 +30,7 @@ static HIGH_SCORE *CONST tables[] =
/*{{{ prototypes*/
static unsigned expire PROTOARG((time_t, time_t));
static unsigned file_changed PROTOARG((char CONST *));
-static FILE *get_lock PROTOARG((char CONST *, unsigned));
+static unsigned get_lock PROTOARG((FILE *));
static VOIDFUNC get_unlock PROTOARG((FILE *));
static unsigned insert_personal PROTOARG((HIGH_SCORE CONST *));
static unsigned insert_score
@@ -106,33 +107,29 @@ FUNCARG((name),
return changed;
}
/*}}}*/
-/*{{{ void get_lock(name, flag)*/
-static FILE *get_lock
-FUNCARG((name, flag),
- char CONST *name
-ARGSEP unsigned flag
+/*{{{ unsigned get_lock(stream)*/
+static unsigned get_lock
+FUNCARG((stream),
+ FILE *stream
)
/*
- * open and locks a high score file
- * flag & 1 == 0 -> "r+"
- * flag & 1 != 0 -> "w+"
- * flag & 2 inhibit error message
+ * lock the high score file
*/
{
- FILE *stream;
-
- stream = fopen(name, flag & 1 ? "w+" : "r+");
- if(!stream && !(flag & 2))
- perror(name);
- if(stream)
/*{{{ get lock on the file*/
- while(lock_file(stream))
+ while(1)
{
- if(errno == EINTR)
- continue;
+ int res = lock_file(stream);
+ if(res)
+ {
+ if(errno == EINTR)
+ continue;
+ perror("Error locking score file");
+ }
+
+ return res == 0;
}
/*}}}*/
- return stream;
}
/*}}}*/
/*{{{ void get_unlock(stream)*/
@@ -141,14 +138,10 @@ FUNCARG((stream),
FILE *stream
)
/*
- * unlock and close the high score file
+ * unlock the high score file
*/
{
- fflush(stream);
- rewind(stream);
unlock_file(stream);
- fclose(stream);
- return;
}
/*}}}*/
/*{{{ void high_score(score, screen, msec)*/
@@ -186,7 +179,6 @@ extern VOIDFUNC init_scores FUNCARGVOID
char CONST *user;
char CONST *home;
char *reallife;
- size_t dirlen;
user = NULL;
home = NULL;
@@ -287,13 +279,12 @@ extern VOIDFUNC init_scores FUNCARGVOID
/*}}}*/
/*{{{ score directory?*/
{
- dirlen = strlen(score_dir);
- score_file = malloc(dirlen + 14);
- if(score_file)
- {
- strcpy(score_file, score_dir);
- strcpy(&score_file[dirlen], "/xmris.score");
- }
+ score_stream = fopen(score_file, "r+");
+ /* If we cannot open it, try creating it */
+ if(!score_stream)
+ score_stream = fopen(score_file, "w+");
+ if (!score_stream)
+ score_file = NULL;
}
/*}}}*/
/*{{{ personal file*/
@@ -310,6 +301,15 @@ extern VOIDFUNC init_scores FUNCARGVOID
{
strcpy(personal_file, home);
strcpy(&personal_file[length], "/.xmris.score");
+
+ personal_stream = fopen(personal_file, "r+");
+ if(!personal_stream)
+ personal_stream = fopen(personal_file, "w+");
+ if(!personal_stream)
+ {
+ free(personal_file);
+ personal_file = NULL;
+ }
}
}
}
@@ -320,6 +320,24 @@ extern VOIDFUNC init_scores FUNCARGVOID
return;
}
/*}}}*/
+/*{{{ void init_scores()*/
+extern VOIDFUNC cleanup_scores FUNCARGVOID
+/*
+ * Close open score files
+ */
+{
+ if(score_stream)
+ {
+ fclose(score_stream);
+ score_stream = NULL;
+ }
+ if(personal_stream)
+ {
+ fclose(personal_stream);
+ personal_stream = NULL;
+ }
+}
+/*}}}*/
/*{{{ unsigned insert_personal(sptr)*/
static unsigned insert_personal
FUNCARG((sptr),
@@ -407,32 +425,23 @@ FUNCARG((insert),
* write the files back
*/
{
- FILE *score_stream;
- FILE *personal_stream;
- unsigned do_score, do_personal;
-
- score_stream = personal_stream = NULL;
- do_score = do_personal = 0;
- /*{{{ score_file?*/
- if(score_file)
+ unsigned do_score = 0, do_personal = 0;
+ unsigned score_lock = 0, personal_lock = 0;
+
+ if(score_stream)
{
- score_stream = get_lock(score_file, 2);
- if(score_stream)
+ score_lock = get_lock(score_stream);
+ if(score_lock)
do_score = merge_scores(score_stream);
- else
- do_score = 1;
}
- /*}}}*/
- /*{{{ personal_file?*/
- if(personal_file)
+
+ if(personal_stream)
{
- personal_stream = get_lock(personal_file, 2);
- if(personal_stream)
+ personal_lock = get_lock(personal_stream);
+ if(personal_lock)
do_personal = merge_personal(personal_stream);
- else
- do_personal = 1;
}
- /*}}}*/
+
/*{{{ check alternate*/
if(alternate)
{
@@ -930,37 +939,23 @@ FUNCARG((insert),
}
/*}}}*/
/*{{{ write_score?*/
- if(do_score)
+ if(do_score && score_lock)
{
- if(!score_stream && score_file)
- {
- score_stream = get_lock(score_file, 5);
- if(!score_stream)
- score_file = NULL;
- }
- if(score_stream)
- write_scores(score_stream);
+ write_scores(score_stream);
+ file_changed(score_file);
}
/*}}}*/
/*{{{ write personal?*/
- if(do_personal)
+ if(do_personal && personal_lock)
{
- if(!personal_stream)
- personal_stream = get_lock(personal_file, 1);
- if(personal_stream)
- write_personal(personal_stream);
- else
- personal_file = NULL;
+ write_personal(personal_stream);
+ file_changed(personal_file);
}
/*}}}*/
- if(personal_stream)
+ if(personal_lock)
get_unlock(personal_stream);
- if(score_stream)
+ if(score_lock)
get_unlock(score_stream);
- if(do_score && score_file)
- file_changed(score_file);
- if(do_personal && personal_file)
- file_changed(personal_file);
return;
}
/*}}}*/
@@ -1218,6 +1213,7 @@ FUNCARG((stream),
check = 0;
}
fprintf(stream, "+%lu\n", check);
+ fflush(stream);
return;
}
/*}}}*/
@@ -1245,6 +1241,7 @@ FUNCARG((stream),
check = 0;
}
fprintf(stream, "+%lu %s\n", check, date_format);
+ fflush(stream);
return;
}
/*}}}*/
diff --git a/xmris.c b/xmris.c
index b1a0404..f10e3f7 100644
--- a/xmris.c
+++ b/xmris.c
@@ -1348,6 +1348,7 @@ ARGSEP char CONST **argv
assert(monster.normals < 20);
}
timer_close();
+ cleanup_scores();
return 0;
}
/*}}}*/
diff --git a/xmris.h b/xmris.h
index 1e696c5..34969df 100644
--- a/xmris.h
+++ b/xmris.h
@@ -536,6 +536,7 @@ extern unsigned move_player PROTOARG((VOIDARG));
extern VOIDFUNC check_scores PROTOARG((VOIDARG));
extern VOIDFUNC high_score PROTOARG((unsigned long, unsigned, unsigned long));
extern VOIDFUNC init_scores PROTOARG((VOIDARG));
+extern VOIDFUNC cleanup_scores PROTOARG((VOIDARG));
/*}}}*/
/*{{{ timer*/
extern VOIDFUNC timer_close PROTOARG((VOIDARG));
--
1.7.5
0016-Open-the-global-score-file-asap-and-drop-special-rig.patch:
Imakefile | 4 ++--
scoring.c | 42 ++++++++++++++++++++++++++++++++----------
xmris.c | 2 ++
xmris.h | 2 +-
4 files changed, 37 insertions(+), 13 deletions(-)
--- NEW FILE 0016-Open-the-global-score-file-asap-and-drop-special-rig.patch ---
>From 74743124c7cd2ed7ff5e33e436a73d3f0f70ce6a Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Sun, 1 May 2011 11:12:09 +0200
Subject: [PATCH 16/20] Open the global score file asap, and drop special
rights directly after
This completes making the highscore code truely safe for sgid usage.
---
Imakefile | 4 ++--
scoring.c | 42 ++++++++++++++++++++++++++++++++----------
xmris.c | 2 ++
xmris.h | 1 +
4 files changed, 37 insertions(+), 12 deletions(-)
diff --git a/Imakefile b/Imakefile
index dcf93c8..09931d8 100644
--- a/Imakefile
+++ b/Imakefile
@@ -85,9 +85,9 @@ XCOMM install parameters
XCOMM
XCOMM owner and access rights for executable & score directory
XCOMM these are set for a setuid xmris
-XCOMM OWNER = -o games
+XCOMM OWNER = -g games
OWNER =
-INSTMRISFLAGS = $(OWNER) $(INSTUIDFLAGS)
+INSTMRISFLAGS = $(OWNER) $(INSTGIDFLAGS)
XCOMM normal install locations
THEBINDIR = $(BINDIR)
THEMANDIR = $(MANDIR)
diff --git a/scoring.c b/scoring.c
index 381057b..45c14d8 100644
--- a/scoring.c
+++ b/scoring.c
@@ -1,4 +1,5 @@
/* Copyright (C) 1993, 1992 Nathan Sidwell */
+#define _GNU_SOURCE /* for setresuid / setresgid */
#include "xmris.h"
/*{{{ other includes*/
#include <pwd.h>
@@ -169,6 +170,37 @@ ARGSEP unsigned long msec
return;
}
/*}}}*/
+/*{{{ void init_scores_early()*/
+extern VOIDFUNC init_scores_early FUNCARGVOID
+/*
+ * To be called asap from main, open the global highscore file and drop
+ * sgid rights
+ */
+{
+ /* Figure out who we really are. */
+ gid_t realgid = getgid();
+ uid_t realuid = getuid();
+
+ score_stream = fopen(score_file, "r+");
+ /* If we cannot open it, try creating it */
+ if(!score_stream)
+ score_stream = fopen(score_file, "w+");
+ if(!score_stream)
+ score_file = NULL;
+
+ /* This is where we drop our setuid/setgid privileges. */
+ if(setresgid(-1, realgid, realgid) != 0)
+ {
+ perror("Could not drop setgid privileges. Aborting.");
+ exit(1);
+ }
+ if(setresuid(-1, realuid, realuid) != 0)
+ {
+ perror("Could not drop setuid privileges. Aborting.");
+ exit(1);
+ }
+}
+/*}}}*/
/*{{{ void init_scores()*/
extern VOIDFUNC init_scores FUNCARGVOID
/*
@@ -277,16 +309,6 @@ extern VOIDFUNC init_scores FUNCARGVOID
scoring.alternate = alternate;
}
/*}}}*/
- /*{{{ score directory?*/
- {
- score_stream = fopen(score_file, "r+");
- /* If we cannot open it, try creating it */
- if(!score_stream)
- score_stream = fopen(score_file, "w+");
- if (!score_stream)
- score_file = NULL;
- }
- /*}}}*/
/*{{{ personal file*/
{
if(!home)
diff --git a/xmris.c b/xmris.c
index f10e3f7..a38139d 100644
--- a/xmris.c
+++ b/xmris.c
@@ -1259,6 +1259,8 @@ ARGSEP char CONST **argv
PROTOANIMATE((*animate));
Atom wm_delete_window;
+ init_scores_early();
+
myname = *argv ? *argv : "Xmris";
open_toolkit(argc, (String *)argv);
init_scores();
diff --git a/xmris.h b/xmris.h
index 34969df..99af882 100644
--- a/xmris.h
+++ b/xmris.h
@@ -535,6 +535,7 @@ extern unsigned move_player PROTOARG((VOIDARG));
/*{{{ scoring*/
extern VOIDFUNC check_scores PROTOARG((VOIDARG));
extern VOIDFUNC high_score PROTOARG((unsigned long, unsigned, unsigned long));
+extern VOIDFUNC init_scores_early PROTOARG((VOIDARG));
extern VOIDFUNC init_scores PROTOARG((VOIDARG));
extern VOIDFUNC cleanup_scores PROTOARG((VOIDARG));
/*}}}*/
--
1.7.5
0017-Set-class-to-Xmsit-Xmris-depending-on-how-we-re-laun.patch:
Imakefile | 7 ++++++-
makemris.c | 4 ++--
2 files changed, 8 insertions(+), 3 deletions(-)
--- NEW FILE 0017-Set-class-to-Xmsit-Xmris-depending-on-how-we-re-laun.patch ---
>From 07e599150a81a85f327ad8b84102c359da442ed8 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Mon, 2 May 2011 11:58:04 +0200
Subject: [PATCH 17/20] Set class to Xmsit / Xmris depending on how we're
launched
And also create a separate Xmsit.ad with gender: she so that launching as
xmsit actually gives us msit.
---
Imakefile | 7 ++++++-
makemris.c | 3 ++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Imakefile b/Imakefile
index 09931d8..31c8550 100644
--- a/Imakefile
+++ b/Imakefile
@@ -209,7 +209,7 @@ all :: initialize
all :: xmris xmred
@#keep gnumake happy
-all :: README.xmris README.xmred Xmris.ad
+all :: README.xmris README.xmred Xmris.ad Xmsit.ad
@#keep gnumake happy
XCOMM rules to make sure the initialize thing is done
@@ -251,10 +251,14 @@ InstallManPage(xmred,$(THEMANDIR))
XCOMM application resource files
InstallAppDefaults(Xmris)
+InstallAppDefaults(Xmsit)
Xmris.ad : Xmris-ad.src
sed -e s@FONT@$(FONT)@ < Xmris-ad.src > Xmris.ad
+Xmsit.ad : Xmris.ad
+ sed -e "s@Gender:\t\the@Gender:\t\tshe@" < Xmris.ad > Xmsit.ad
+
#ifdef InstallDefaultGardens
XCOMM install default gardens
install :: $(GARDENS)
@@ -273,6 +277,7 @@ NormalProgramTarget(scram,$(SCRAMOBJS),,,)
clean ::
$(RM) $(MRISOBJS)
$(RM) Xmris.ad
+ $(RM) Xmsit.ad
$(RM) $(MREDOBJS)
$(RM) $(WIDGETOBJS)
$(RM) $(SCRAMOBJS)
diff --git a/makemris.c b/makemris.c
index 95046d7..6b129c1 100644
--- a/makemris.c
+++ b/makemris.c
@@ -274,13 +274,14 @@ ARGSEP String *argv
if(data.nodisplay == False)
{
XrmOptionDescRec CONST *ptr;
+ const char *myclass = default_gender ? "Xmsit" : "Xmris";
/* as options is an extern of unknown size, I can't use
* XtNumber() to get its size, so I've done it this way
*/
for(ptr = options; *(char CONST **)ptr; ptr++)
/* EMPTY */;
- display.toplevel = XtAppInitialize(&display.context, "Xmris",
+ display.toplevel = XtAppInitialize(&display.context, myclass,
options, (Cardinal)(ptr - options),
&argc, (String *)argv,
(String *)NULL, toplevel_args, XtNumber(toplevel_args));
--
1.7.5
0018-Install-manpages-into-section-6-rather-then-1.patch:
Imakefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- NEW FILE 0018-Install-manpages-into-section-6-rather-then-1.patch ---
>From ce1204bfff0c925002033206659c755ab589adb4 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Mon, 2 May 2011 12:00:32 +0200
Subject: [PATCH 18/20] Install manpages into section 6 rather then 1
---
Imakefile | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Imakefile b/Imakefile
index 31c8550..b999fda 100644
--- a/Imakefile
+++ b/Imakefile
@@ -90,7 +90,8 @@ OWNER =
INSTMRISFLAGS = $(OWNER) $(INSTGIDFLAGS)
XCOMM normal install locations
THEBINDIR = $(BINDIR)
-THEMANDIR = $(MANDIR)
+THEMANDIR = $(MANSOURCEPATH)6
+MANSUFFIX = 6
XCOMM INSTMRISFLAGS = $(INSTPGMFLAGS)
XCOMM If you're not installing in the default locations
XCOMM DESTDIR =
--
1.7.5
0019-Add-.desktop-files.patch:
xmred.desktop | 9 +++++++++
xmris.desktop | 9 +++++++++
xmsit.desktop | 10 +++++++++-
3 files changed, 27 insertions(+), 1 deletion(-)
--- NEW FILE 0019-Add-.desktop-files.patch ---
>From e9445fb7ea16fdbcfe7577dfbad3544c90670fe8 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Sun, 1 May 2011 17:14:50 +0200
Subject: [PATCH 19/20] Add .desktop files
---
xmred.desktop | 9 +++++++++
xmris.desktop | 9 +++++++++
xmsit.desktop | 9 +++++++++
3 files changed, 27 insertions(+), 0 deletions(-)
create mode 100644 xmred.desktop
create mode 100644 xmris.desktop
create mode 100644 xmsit.desktop
diff --git a/xmred.desktop b/xmred.desktop
new file mode 100644
index 0000000..e60a49f
--- /dev/null
+++ b/xmred.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=X Mr Ed
+Comment=Level Editor for X Mr Is
+Exec=xmred
+Icon=xmris
+Terminal=false
+StartupNotify=false
+Type=Application
+Categories=Game;ArcadeGame;
diff --git a/xmris.desktop b/xmris.desktop
new file mode 100644
index 0000000..6cd97f2
--- /dev/null
+++ b/xmris.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=X Mr Is
+Comment=Maze digging and cherry eating game
+Exec=xmris
+Icon=xmris
+Terminal=false
+StartupNotify=false
+Type=Application
+Categories=Game;ArcadeGame;
diff --git a/xmsit.desktop b/xmsit.desktop
new file mode 100644
index 0000000..e14bdef
--- /dev/null
+++ b/xmsit.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=X Ms It
+Comment=Maze digging and cherry eating game
+Exec=xmsit
+Icon=xmsit
+Terminal=false
+StartupNotify=false
+Type=Application
+Categories=Game;ArcadeGame;
--
1.7.5
--- NEW FILE xmris.spec ---
Name: xmris
Version: 4.0.5
Release: 2%{?dist}
Summary: Maze digging and cherry eating game
Group: Amusements/Games
License: GPL+
URL: http://sourceforge.net/projects/xmris/
Source0: http://downloads.sourceforge.net/xmris/xmris.%{version}.tar.gz
# These were created from screenshots from the game
Source1: xmris.png
Source2: xmsit.png
# Various fixes
Patch1: 0001-Fix-xm-exiting-with-a-BadFont-error.patch
Patch2: 0002-Fix-timer-signal-handling-under-Linux.patch
Patch3: 0003-Adjust-Imakefile-for-modern-systems.patch
Patch4: 0004-Catch-the-window-being-deleted.patch
Patch5: 0005-Fix-compiling-of-flock-code-under-Linux.patch
Patch6: 0006-Fix-key-presses-getting-lost.patch
Patch7: 0007-Change-key-binding-defaults-to-something-sane.patch
Patch8: 0008-Fix-compiler-warnings.patch
# Patches for safe global highscore handling
Patch9: 0009-Remove-TRANSPUTER-stuff.patch
Patch10: 0010-Remove-USELOCKFILE-stuff.patch
Patch11: 0011-Remove-seteuid-stuff.patch
Patch12: 0012-Drop-dir-option.patch
Patch13: 0013-Drop-support-for-global-personal-file.patch
Patch14: 0014-Some-renames.patch
Patch15: 0015-Open-score-files-only-once-and-keep-them-open-till-t.patch
Patch16: 0016-Open-the-global-score-file-asap-and-drop-special-rig.patch
# Misc patches
Patch17: 0017-Set-class-to-Xmsit-Xmris-depending-on-how-we-re-laun.patch
Patch18: 0018-Install-manpages-into-section-6-rather-then-1.patch
Patch19: 0019-Add-.desktop-files.patch
BuildRequires: libXt-devel libXaw-devel groff imake desktop-file-utils
Requires: hicolor-icon-theme
Requires: xorg-x11-fonts-ISO8859-1-75dpi
Requires: xorg-x11-fonts-ISO8859-1-100dpi
%description
You control a gnome, who can walk around a garden, along paths already
marked, or create new paths wherever you wish. You also have a ball,
which can be thrown in the direction you're facing, towards the gnome's
feet. Points are scored for collecting cherries (if you collect eight
cherries without stopping or pushing an apple, you get a bonus),
killing monsters (by squashing them, or throwing the ball at them), and
collecting the prize left when all the monsters have come out of their
den.
%package editor
Summary: Level editor for %{name}
Requires: %{name} = %{version}-%{release}
%description editor
A level editor for %{name}.
%prep
%setup -q -n %{name}.%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%build
xmkmf
make %{?_smp_mflags} CDEBUGFLAGS="$RPM_OPT_FLAGS"
%install
make install install.man DESTDIR=$RPM_BUILD_ROOT
rm $RPM_BUILD_ROOT/usr/lib/X11/app-defaults
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/games
touch $RPM_BUILD_ROOT%{_localstatedir}/games/%{name}.score
mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/128x128/apps
install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/128x128/apps
install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/128x128/apps
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install --dir $RPM_BUILD_ROOT%{_datadir}/applications xm*.desktop
%post
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
%postun
if [ $1 -eq 0 ] ; then
touch --no-create %{_datadir}/icons/hicolor &>/dev/null
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi
%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%files
%defattr(-,root,root,-)
%doc CHANGES* COPYING-2.0 COPYRIGHT README.xmris
%attr(2755,root,games) %{_bindir}/%{name}
%{_bindir}/xmsit
%{_datadir}/%{name}
%{_datadir}/X11/app-defaults/Xm*
%{_datadir}/applications/xmris.desktop
%{_datadir}/applications/xmsit.desktop
%{_datadir}/icons/hicolor/128x128/apps/xm*.png
%{_mandir}/man6/xmris.6*
%{_mandir}/man6/xmsit.6*
%verify(not md5 size mtime) %config(noreplace) %attr(0664,root,games) %{_localstatedir}/games/%{name}.score
%files editor
%defattr(-,root,root,-)
%doc README.xmred
%{_bindir}/xmred
%{_datadir}/applications/xmred.desktop
%{_mandir}/man6/xmred.6*
%changelog
* Sat May 21 2011 Hans de Goede <j.w.r.degoede(a)gmail.com> 4.0.5-2
- Add missing BuildRequires: libXaw-devel groff
- Change font requires to: xorg-x11-fonts-ISO8859-1-75dpi + 100dpi
* Tue May 3 2011 Hans de Goede <j.w.r.degoede(a)gmail.com> 4.0.5-1
- Initial rpmfusion package
Index: .cvsignore
===================================================================
RCS file: /cvs/free/rpms/xmris/F-14/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore 7 Jun 2011 15:38:59 -0000 1.1
+++ .cvsignore 23 Jun 2011 20:07:26 -0000 1.2
@@ -0,0 +1 @@
+xmris.4.0.5.tar.gz
Index: sources
===================================================================
RCS file: /cvs/free/rpms/xmris/F-14/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources 7 Jun 2011 15:38:59 -0000 1.1
+++ sources 23 Jun 2011 20:07:31 -0000 1.2
@@ -0,0 +1 @@
+108beb6df3cda34f6797605e975345a8 xmris.4.0.5.tar.gz
13 years, 5 months
rpms/xmris/F-15 0001-Fix-xm-exiting-with-a-BadFont-error.patch, NONE, 1.1 0002-Fix-timer-signal-handling-under-Linux.patch, NONE, 1.1 0003-Adjust-Imakefile-for-modern-systems.patch, NONE, 1.1 0004-Catch-the-window-being-deleted.patch, NONE, 1.1 0005-Fix-compiling-of-flock-code-under-Linux.patch, NONE, 1.1 0006-Fix-key-presses-getting-lost.patch, NONE, 1.1 0007-Change-key-binding-defaults-to-something-sane.patch, NONE, 1.1 0008-Fix-compiler-warnings.patch, NONE, 1.1 0009-Remove-TRANSPUTER-stuff.patch, NONE,
by jwrdegoede
Author: jwrdegoede
Update of /cvs/free/rpms/xmris/F-15
In directory se02.es.rpmfusion.net:/tmp/cvs-serv21641
Modified Files:
.cvsignore sources
Added Files:
0001-Fix-xm-exiting-with-a-BadFont-error.patch
0002-Fix-timer-signal-handling-under-Linux.patch
0003-Adjust-Imakefile-for-modern-systems.patch
0004-Catch-the-window-being-deleted.patch
0005-Fix-compiling-of-flock-code-under-Linux.patch
0006-Fix-key-presses-getting-lost.patch
0007-Change-key-binding-defaults-to-something-sane.patch
0008-Fix-compiler-warnings.patch
0009-Remove-TRANSPUTER-stuff.patch
0010-Remove-USELOCKFILE-stuff.patch
0011-Remove-seteuid-stuff.patch 0012-Drop-dir-option.patch
0013-Drop-support-for-global-personal-file.patch
0014-Some-renames.patch
0015-Open-score-files-only-once-and-keep-them-open-till-t.patch
0016-Open-the-global-score-file-asap-and-drop-special-rig.patch
0017-Set-class-to-Xmsit-Xmris-depending-on-how-we-re-laun.patch
0018-Install-manpages-into-section-6-rather-then-1.patch
0019-Add-.desktop-files.patch xmris.png xmris.spec xmsit.png
Log Message:
* Sat May 21 2011 Hans de Goede <j.w.r.degoede(a)gmail.com> 4.0.5-2
- Add missing BuildRequires: libXaw-devel groff
- Change font requires to: xorg-x11-fonts-ISO8859-1-75dpi + 100dpi
0001-Fix-xm-exiting-with-a-BadFont-error.patch:
defcom.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- NEW FILE 0001-Fix-xm-exiting-with-a-BadFont-error.patch ---
>From 2e28187cbb718044cd963d7290f2a4611c305a9a Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Mon, 29 Nov 2010 22:34:51 +0100
Subject: [PATCH 01/20] Fix xm* exiting with a BadFont error
---
defcom.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/defcom.c b/defcom.c
index 8f354dd..f8a59b5 100644
--- a/defcom.c
+++ b/defcom.c
@@ -265,7 +265,7 @@ XtResource resources[] =
#endif /* TRANSPUTER */
#endif /* XMRED */
{XtNfont, XtCFont, XtRFont, sizeof(Font),
- XtOffsetOf(DATA, font), XtRImmediate, (XtPointer)FONT_NAME},
+ XtOffsetOf(DATA, font), XtRString, (XtPointer)FONT_NAME},
{XtNreverseVideo, XtCReverseVideo, XtRBoolean, sizeof(Boolean),
XtOffsetOf(DATA, swap), XtRImmediate, (XtPointer)False},
{"monochrome", "Monochrome", XtRBoolean, sizeof(Boolean),
--
1.7.5
0002-Fix-timer-signal-handling-under-Linux.patch:
timer.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
--- NEW FILE 0002-Fix-timer-signal-handling-under-Linux.patch ---
>From 10e609fae72b30ee7763e95f202d3ecad13685e6 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Mon, 29 Nov 2010 23:26:44 +0100
Subject: [PATCH 02/20] Fix timer signal handling under Linux
---
timer.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/timer.c b/timer.c
index 4f56727..c8fa2c1 100644
--- a/timer.c
+++ b/timer.c
@@ -75,7 +75,7 @@
* signal_release returns the block mask to what it was before signal_hold
*/
#ifndef TRANSPUTER
-#ifdef POSIX
+#if defined POSIX || defined linux
# define MASK sigset_t
# define signal_hold(signal, maskp) \
{\
@@ -85,7 +85,11 @@
sigprocmask(SIG_BLOCK, &temp, (maskp)); \
}
# define signal_release(maskp) sigprocmask(SIG_SETMASK, maskp, (MASK *)NULL)
-# define signal_pause(maskp) sigpause(*(maskp))
+# ifdef linux
+# define signal_pause(maskp) sigsuspend(maskp)
+# else
+# define signal_pause(maskp) sigpause(*(maskp))
+# endif
#else
# ifdef __hpux /* hpux is a weird mixture of BSD & SYSV */
/* don't know if this is right */
--
1.7.5
0003-Adjust-Imakefile-for-modern-systems.patch:
Imakefile | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
--- NEW FILE 0003-Adjust-Imakefile-for-modern-systems.patch ---
>From e9da98bfc559f227fe7784f227ff631e2a774c3f Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Mon, 29 Nov 2010 23:18:26 +0100
Subject: [PATCH 03/20] Adjust Imakefile for modern systems
---
Imakefile | 27 ++++++++++++---------------
1 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/Imakefile b/Imakefile
index 43345c6..a6c6842 100644
--- a/Imakefile
+++ b/Imakefile
@@ -31,10 +31,10 @@ install.man :: @@\
XCOMM compiler options
XCOMM
#if HasGcc
-EXTRACCOPTIONS = -Wall -Wpointer-arith -Wwrite-strings -Wtraditional
+EXTRACCOPTIONS = -Wall -Wpointer-arith -Wno-write-strings
#endif /* HasGcc */
#if defined(LinuxArchitecture)
-#define STATICDEBUG -static
+#define STATICDEBUG
XCOMM XINTL=-lXintl
#else
#define STATICDEBUG
@@ -61,7 +61,7 @@ TIME =
XCOMM TIME = -DUSETIME
XCOMM don't you have lockf or flock?
LOCK =
-LOCK = -DUSELOCKFILE
+XCOMM LOCK = -DUSELOCKFILE
XCOMM game defaults, you probably only want to alter the SCORE
XCOMM
@@ -69,9 +69,9 @@ XCOMM
/* #define thefont "-*-courier-*-r-*-*-18-*-*-*-m-*-*-*" */
XCOMM where is the high score file?
XCOMM SCORE = $(LOCAL)/lib/$(APP)
-SCORE = /var/lib/games/$(APP)
-/* to install default gardens not in app_defaults/$(APP)
-/* #define InstallDefaultGardens $(SCORE)/gardens */
+SCORE = /var/games/$(APP)
+/* to install default gardens not in /usr/share/$(APP) */
+/* #define InstallDefaultGardens $(DESTDIR)/usr/share/$(APP) */
XCOMM The following defines are needed for some implementations and/or sites.
XCOMM It is xmkmf's job to get these right in the first place.
@@ -91,7 +91,8 @@ XCOMM install parameters
XCOMM
XCOMM owner and access rights for executable & score directory
XCOMM these are set for a setuid xmris
-OWNER = -o games
+XCOMM OWNER = -o games
+OWNER =
INSTSCOREFLAGS = $(OWNER) -m 755
INSTMRISFLAGS = $(OWNER) $(INSTUIDFLAGS)
XCOMM normal install locations
@@ -115,7 +116,7 @@ FONT = thefont
#ifndef InstallDefaultGardens
#ifdef InstallAppDefFiles
-#define InstallDefaultGardens $(DESTDIR)/$(XAPPLOADDIR)/$(APP)
+#define InstallDefaultGardens $(DESTDIR)/usr/share/$(APP)
#endif
#endif
@@ -213,10 +214,6 @@ XCOMM using alltarget can cause gnumake to try and make a target called all.
XCOMM the reason is the All Target macro has no rules, so gnumake tries
XCOMM to find an implicit one. Other makes just give up.
all :: initialize
- @echo "NOTE:You might get lots of warnings about discarding const from"
- @echo "NOTE:pointer target type. Ignore these. It's because the X header"
- @echo "NOTE:files aren't const correct. Fiddle with XrmOptionDescRec in"
- @echo "NOTE:Xresource.h and String in Intrinsic.h by adding an _Xconst."
@#keep gnumake happy
all :: xmris xmred
@@ -238,9 +235,9 @@ NormalProgramTarget(xmris,$(MRISOBJS),$(DEPLIBS),$(LOCAL_LIBRARIES),)
InstallProgramWithFlags(xmris,$(THEBINDIR),$(INSTMRISFLAGS))
-install :: $(THEBINDIR)/xmris
- $(RM) $(THEBINDIR)/xmsit
- $(LN) ./xmris $(THEBINDIR)/xmsit
+install :: $(DESTDIR)$(THEBINDIR)/xmris
+ $(RM) $(DESTDIR)$(THEBINDIR)/xmsit
+ $(LN) xmris $(DESTDIR)$(THEBINDIR)/xmsit
XCOMM xmred build
NormalProgramTarget(xmred,$(MREDOBJS) $(WIDGETOBJS),$(DEPLIBS),$(LOCAL_LIBRARIES) -lm,)
--
1.7.5
0004-Catch-the-window-being-deleted.patch:
xmris.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
--- NEW FILE 0004-Catch-the-window-being-deleted.patch ---
>From 5ffc5a653acb6f4d9747f98d05e3a86119baeb9f Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Mon, 29 Nov 2010 22:28:49 +0100
Subject: [PATCH 04/20] Catch the window being deleted
This fixes the keyboard repeat getting fsck-ed up when quiting using
the window delete button on the title bar / alt+f4 while playing the game.
This patch comes from the Mandriva SRPM, thanks guys!
---
xmris.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/xmris.c b/xmris.c
index 77cd0ea..22fa1af 100644
--- a/xmris.c
+++ b/xmris.c
@@ -55,6 +55,8 @@ static VOIDFUNC action_pause
PROTOARG((Widget, XEvent *, String *, Cardinal *));
static VOIDFUNC action_unmap
PROTOARG((Widget, XEvent *, String *, Cardinal *));
+static VOIDFUNC action_quit
+ PROTOARG((Widget, XEvent *, String *, Cardinal *));
static VOIDFUNC age_scores PROTOARG((VOIDARG));
static PROTOANIMATE(animate_death);
static PROTOANIMATE(animate_pause);
@@ -75,6 +77,7 @@ static XtActionsRec actions[] =
{"map", action_map},
{"unmap", action_unmap},
{"expose", action_expose},
+ {"quit", action_quit},
};
/*}}}*/
/*{{{ static char CONST garden_translations[] =*/
@@ -96,6 +99,7 @@ static char CONST toplevel_translations[] =
"\
<MapNotify>:map()\n\
<UnmapNotify>:unmap()\n\
+<Message>WM_PROTOCOLS: quit()\n\
";
/*}}}*/
/*}}}*/
@@ -116,6 +120,22 @@ ARGSEP Cardinal *num_params
return;
}
/*}}}*/
+/*{{{ void action_quit(widget, event, params, num_params)*/
+static VOIDFUNC action_quit
+FUNCARG((widget, event, params, num_params),
+ Widget widget
+ARGSEP XEvent *event
+ARGSEP String *params
+ARGSEP Cardinal *num_params
+)
+{
+#ifdef DEBUGEVENTLOOP
+ fprintf(stderr, "action_quit(0x%lx)\n", XtWindow(widget));
+#endif /* DEBUGEVENTLOOP */
+ set_key_default();
+ global.quit = 1;
+}
+/*}}}*/
/*{{{ void action_keypress(widget, event, params, num_params)*/
static VOIDFUNC action_keypress
FUNCARG((widget, event, params, num_params),
@@ -1235,6 +1255,7 @@ ARGSEP char CONST **argv
)
{
PROTOANIMATE((*animate));
+ Atom wm_delete_window;
myname = *argv ? *argv : "Xmris";
#ifndef TRANSPUTER
@@ -1280,6 +1301,10 @@ ARGSEP char CONST **argv
XtOverrideTranslations(display.toplevel,
XtParseTranslationTable(toplevel_translations));
XtRealizeWidget(display.toplevel);
+ wm_delete_window = XInternAtom(XtDisplay(display.toplevel), "WM_DELETE_WINDOW",
+ False);
+ (void)XSetWMProtocols(XtDisplay(display.toplevel), XtWindow(display.toplevel),
+ &wm_delete_window, 1);
#ifdef DEBUGEVENTLOOP
printf("Toplevel is 0x%lx\n", (long)XtWindow(display.toplevel));
printf("Garden is 0x%lx\n", (long)XtWindow(display.garden));
--
1.7.5
0005-Fix-compiling-of-flock-code-under-Linux.patch:
scoring.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- NEW FILE 0005-Fix-compiling-of-flock-code-under-Linux.patch ---
>From 51f13c5ef15a4a63e5184579ac1ddc8fab03382b Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Mon, 29 Nov 2010 23:30:59 +0100
Subject: [PATCH 05/20] Fix compiling of flock code under Linux
---
scoring.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/scoring.c b/scoring.c
index 0c61b9b..6f1030f 100644
--- a/scoring.c
+++ b/scoring.c
@@ -38,6 +38,9 @@
/*}}}*/
/*{{{ file locking*/
#ifndef SYSV
+#ifdef linux
+#include <sys/file.h>
+#endif
#define lock_file(stream) flock(fileno(stream), LOCK_EX)
#define unlock_file(stream) flock(fileno(stream), LOCK_UN)
#else
--
1.7.5
0006-Fix-key-presses-getting-lost.patch:
xmris.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- NEW FILE 0006-Fix-key-presses-getting-lost.patch ---
>From 3acb9936eb6ec40de5188c47e5a720d375657ba8 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Tue, 30 Nov 2010 15:00:29 +0100
Subject: [PATCH 06/20] Fix key presses getting lost
Without this patch keypresses get lost when the mouse is outside the window,
but the keyboard focus is on the window.
---
xmris.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/xmris.c b/xmris.c
index 22fa1af..2f6cc62 100644
--- a/xmris.c
+++ b/xmris.c
@@ -91,6 +91,8 @@ static char CONST garden_translations[] =
/*{{{ static char CONST form_translations[] =*/
static char CONST form_translations[] =
"\
+<KeyPress>:keypress()\n\
+<KeyRelease>:keyrelease()\n\
<FocusOut>:pause()\n\
";
/*}}}*/
--
1.7.5
0007-Change-key-binding-defaults-to-something-sane.patch:
Xmris-ad.src | 8 ++++----
defcom.c | 8 ++++----
xmris.man | 22 ++++------------------
3 files changed, 12 insertions(+), 26 deletions(-)
--- NEW FILE 0007-Change-key-binding-defaults-to-something-sane.patch ---
>From dc28065b144dbfa1da8007b4482f8415894eee43 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Tue, 30 Nov 2010 15:55:00 +0100
Subject: [PATCH 07/20] Change key binding defaults to something sane
---
Xmris-ad.src | 8 ++++----
defcom.c | 8 ++++----
xmris.man | 21 ++++-----------------
3 files changed, 12 insertions(+), 25 deletions(-)
diff --git a/Xmris-ad.src b/Xmris-ad.src
index fd94b76..60be0ac 100644
--- a/Xmris-ad.src
+++ b/Xmris-ad.src
@@ -4,10 +4,10 @@
! These are some of the resources you can fiddle with for xmris
! The defaults are shown in the man page.
-*Up: apostrophe
-*Down: slash
-*Left: z
-*Right: x
+*Up: Up
+*Down: Down
+*Left: Left
+*Right: Right
*Throw: space
*Pause: p
*Quit: q
diff --git a/defcom.c b/defcom.c
index f8a59b5..5934c5e 100644
--- a/defcom.c
+++ b/defcom.c
@@ -234,13 +234,13 @@ XtResource resources[] =
{"dir", "Dir", XtRString, sizeof(String),
XtOffsetOf(DATA, dir), XtRString, (XtPointer)SCORE_DIR},
{"up", "Up", XtRKeySym, sizeof(KeySym),
- XtOffsetOf(DATA, keysyms[0]), XtRString, (XtPointer)"apostrophe"},
+ XtOffsetOf(DATA, keysyms[0]), XtRString, (XtPointer)"Up"},
{"down", "Down", XtRKeySym, sizeof(KeySym),
- XtOffsetOf(DATA, keysyms[1]), XtRString, (XtPointer)"slash"},
+ XtOffsetOf(DATA, keysyms[1]), XtRString, (XtPointer)"Down"},
{"left", "Left", XtRKeySym, sizeof(KeySym),
- XtOffsetOf(DATA, keysyms[2]), XtRString, (XtPointer)"z"},
+ XtOffsetOf(DATA, keysyms[2]), XtRString, (XtPointer)"Left"},
{"right", "Right", XtRKeySym, sizeof(KeySym),
- XtOffsetOf(DATA, keysyms[3]), XtRString, (XtPointer)"x"},
+ XtOffsetOf(DATA, keysyms[3]), XtRString, (XtPointer)"Right"},
{"throw", "Throw", XtRKeySym, sizeof(KeySym),
XtOffsetOf(DATA, keysyms[KEY_THROW]), XtRString, (XtPointer)"space"},
{"pause", "Pause", XtRKeySym, sizeof(KeySym),
diff --git a/xmris.man b/xmris.man
index 0d69f88..1e7c47f 100644
--- a/xmris.man
+++ b/xmris.man
@@ -401,14 +401,14 @@ defaults in '[]'.)
.br
.ne 11
.TP
-.B Xmris.Up: \fIkeysym\fP [apostrophe]
+.B Xmris.Up: \fIkeysym\fP [Up]
.PD 0
.TP
-.B Xmris.Down: \fIkeysym\fP [slash]
+.B Xmris.Down: \fIkeysym\fP [Down]
.TP
-.B Xmris.Left: \fIkeysym\fP [z]
+.B Xmris.Left: \fIkeysym\fP [Left]
.TP
-.B Xmris.Right: \fIkeysym\fP [x]
+.B Xmris.Right: \fIkeysym\fP [Right]
.TP
.B Xmris.Throw: \fIkeysym\fP [space]
.TP
@@ -493,19 +493,6 @@ Set the number of distinct colours allocated from the colour map.
.B Xmris.Static: \fI{yes, no}\fP [no]
Do not use dynamic background colors.
.PP
-For example, if you want to use the arrow keys, the following will work
-.br
-.ne 6
-.IP
-Xmris.Up: Up
-.br
-Xmris.Down: Down
-.br
-Xmris.Left: Left
-.br
-Xmris.Right: Right
-.br
-.PP
In addition, you have the normal resources such as '*Font'.
.PP
Normally the cursor is invisible in the Mr Is window. You can force
--
1.7.5
0008-Fix-compiler-warnings.patch:
Drag.c | 3 +--
Icon.c | 3 +--
PixmapList.c | 23 ++++++++++-------------
control.c | 35 +++++++++++++++++------------------
dialogs.c | 8 ++++----
makemred.c | 2 +-
makemris.c | 4 ++--
menubar.c | 12 ++++++------
player.c | 4 ++--
scram.c | 3 +--
10 files changed, 45 insertions(+), 52 deletions(-)
--- NEW FILE 0008-Fix-compiler-warnings.patch ---
>From 383d6b1c86c0697f422e169499ba84c1231f7df5 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Fri, 29 Apr 2011 16:14:33 +0200
Subject: [PATCH 08/20] Fix compiler warnings
---
Drag.c | 3 +--
Icon.c | 3 +--
PixmapList.c | 23 ++++++++++-------------
control.c | 35 +++++++++++++++++------------------
dialogs.c | 8 ++++----
makemred.c | 2 +-
makemris.c | 4 ++--
menubar.c | 12 ++++++------
player.c | 4 ++--
scram.c | 2 +-
10 files changed, 45 insertions(+), 51 deletions(-)
diff --git a/Drag.c b/Drag.c
index 32e863b..6376614 100644
--- a/Drag.c
+++ b/Drag.c
@@ -510,9 +510,8 @@ FUNCARG((widget),
int x, y;
unsigned border;
unsigned depth;
- Status status;
- status = XGetGeometry(XtDisplay(widget), widget->drag.pixmap, &root,
+ XGetGeometry(XtDisplay(widget), widget->drag.pixmap, &root,
&x, &y, &widget->drag.width, &widget->drag.height, &border, &depth);
}
else
diff --git a/Icon.c b/Icon.c
index 215c979..d54a239 100644
--- a/Icon.c
+++ b/Icon.c
@@ -620,9 +620,8 @@ FUNCARG((widget),
int x, y;
unsigned border;
unsigned depth;
- Status status;
- status = XGetGeometry(XtDisplay(widget), widget->icon.pixmap, &root,
+ XGetGeometry(XtDisplay(widget), widget->icon.pixmap, &root,
&x, &y, &widget->icon.width, &widget->icon.height, &border, &depth);
}
else
diff --git a/PixmapList.c b/PixmapList.c
index ab128fa..aeb7155 100644
--- a/PixmapList.c
+++ b/PixmapList.c
@@ -1199,9 +1199,8 @@ ARGSEP PixmapInfo *pi
int x, y;
unsigned border;
unsigned depth;
- Status status;
- status = XGetGeometry(XtDisplay(plw), pi->pixmap,
+ XGetGeometry(XtDisplay(plw), pi->pixmap,
&root, &x, &y, (unsigned int *)&pi->width,
(unsigned int *)&pi->height, &border, &depth);
}
@@ -1359,12 +1358,12 @@ ARGSEP XtPointer call
int length;
plw = (PixmapListWidget)client;
- if(!(int)call)
+ if(!(long)call)
return;
length = plw->pixmap_list.orient == XtorientVertical ?
plw->core.height : plw->core.width;
start = length / 2;
- if((int)call > 0)
+ if((long)call > 0)
start = -start;
start -= plw->pixmap_list.orient == XtorientVertical ?
plw->pixmap_list.y : plw->pixmap_list.x;
@@ -1410,23 +1409,21 @@ FUNCARG((plw),
* our geometry changes
*/
{
- float shown, top;
+ union { float f; XtArgVal xav; } shown, top;
Arg args[2];
if(!plw->pixmap_list.scroll)
return;
- shown = (float)(plw->pixmap_list.orient == XtorientVertical ?
+ shown.f = (float)(plw->pixmap_list.orient == XtorientVertical ?
plw->core.height + 1 : plw->core.width + 1) /
(float)plw->pixmap_list.length;
- if(shown > (float)1.0)
- shown = (float)1.0;
- top = (float)(plw->pixmap_list.orient == XtorientVertical ?
+ if(shown.f > (float)1.0)
+ shown.f = (float)1.0;
+ top.f = (float)(plw->pixmap_list.orient == XtorientVertical ?
-plw->pixmap_list.y : -plw->pixmap_list.x) /
(float)plw->pixmap_list.length;
- XtSetArg(args[0], XtNtopOfThumb, sizeof(float) > sizeof(XtArgVal) ?
- (XtArgVal)&top : *(XtArgVal *)&top);
- XtSetArg(args[1], XtNshown, sizeof(float) > sizeof(XtArgVal) ?
- (XtArgVal)&shown : *(XtArgVal *)&shown);
+ XtSetArg(args[0], XtNtopOfThumb, top.xav);
+ XtSetArg(args[1], XtNshown, shown.xav);
XtSetValues(plw->pixmap_list.scroll, args, 2);
return;
}
diff --git a/control.c b/control.c
index 8261ad4..d5059b4 100644
--- a/control.c
+++ b/control.c
@@ -373,7 +373,7 @@ ARGSEP XtPointer call
{
int delta;
- delta = (int)call ? (int)call < 0 ? -1 : 1 : 0;
+ delta = (long)call ? (long)call < 0 ? -1 : 1 : 0;
if((delta >= 0 || state.counts[5]) && (delta <= 0 ||
state.counts[5] != APPLE_LIMIT))
adjust_count(5, delta);
@@ -431,7 +431,7 @@ ARGSEP XtPointer call
IconCallback *call_data;
int option;
- option = state.button[(unsigned)client];
+ option = state.button[(unsigned long)client];
call_data = (IconCallback *)call;
if(option == OPTION_APPLES)
select_apple(call_data->selection);
@@ -454,13 +454,13 @@ ARGSEP XtPointer call
{
if(state.edit)
{
- state.edit->board->colors = (unsigned)client;
+ state.edit->board->colors = (unsigned long)client;
paint_garden_icon(state.edit);
paint_garden_image();
repaint_garden_icon();
changed_flag |= state.change;
}
- set_icon_color((unsigned)client);
+ set_icon_color((unsigned long)client);
return;
}
/*}}}*/
@@ -477,13 +477,13 @@ ARGSEP XtPointer call
{
if(state.edit)
{
- state.edit->board->fill = (unsigned)client;
+ state.edit->board->fill = (unsigned long)client;
paint_garden_icon(state.edit);
paint_garden_image();
repaint_garden_icon();
changed_flag |= state.change;
}
- set_icon_fill((unsigned)client);
+ set_icon_fill((unsigned long)client);
return;
}
/*}}}*/
@@ -498,9 +498,9 @@ ARGSEP XtPointer call
* change the display mode and update the garden
*/
{
- if(state.mode != (unsigned)client)
+ if(state.mode != (unsigned long)client)
{
- state.mode = (unsigned)client;
+ state.mode = (unsigned long)client;
paint_garden_icon(state.edit);
paint_garden_image();
repaint_garden_icon();
@@ -525,7 +525,7 @@ ARGSEP XtPointer call
IconCallback *call_data;
unsigned option;
- option = (unsigned)client;
+ option = (unsigned long)client;
call_data = (IconCallback *)call;
if(option == OPTION_APPLES)
if(select_apple(call_data->selection))
@@ -802,36 +802,35 @@ FUNCARG((root),
/*{{{ set option callback*/
for(gptr = &gizmos[GIZMO_OPTIONS + OPTIONS - 1], ix = OPTIONS;
ix--; gptr--)
- XtAddCallback(gptr->widget, XtNcallback, command_option, (XtPointer)ix);
+ XtAddCallback(gptr->widget, XtNcallback, command_option, (XtPointer)(unsigned long)ix);
/*}}}*/
/*{{{ set fill callback*/
for(gptr = &gizmos[GIZMO_FILLS + FILLS - 1], ix = FILLS; ix--; gptr--)
- XtAddCallback(gptr->widget, XtNcallback, command_fill, (XtPointer)ix);
+ XtAddCallback(gptr->widget, XtNcallback, command_fill, (XtPointer)(unsigned long)ix);
/*}}}*/
/*{{{ set color callback*/
for(gptr = &gizmos[GIZMO_COLORS + BACKGROUNDS - 1], ix = BACKGROUNDS;
ix--; gptr--)
- XtAddCallback(gptr->widget, XtNcallback, command_color, (XtPointer)ix);
+ XtAddCallback(gptr->widget, XtNcallback, command_color, (XtPointer)(unsigned long)ix);
/*}}}*/
/*{{{ set mode callback*/
for(gptr = &gizmos[GIZMO_DISPLAY_BASE + MODES - 1], ix = MODES;
ix--; gptr--)
- XtAddCallback(gptr->widget, XtNcallback, command_mode, (XtPointer)ix);
+ XtAddCallback(gptr->widget, XtNcallback, command_mode, (XtPointer)(unsigned long)ix);
/*}}}*/
/*{{{ set button callback*/
for(gptr = &gizmos[GIZMO_BUTTONS + BUTTONS - 1], ix = BUTTONS;
ix--; gptr--)
- XtAddCallback(gptr->widget, XtNcallback, command_button, (XtPointer)ix);
+ XtAddCallback(gptr->widget, XtNcallback, command_button, (XtPointer)(unsigned long)ix);
/*}}}*/
/*{{{ setup apple scrollbar*/
{
- float shown;
+ union { float f; XtArgVal xav; } shown;
Arg arg[1];
gptr = &gizmos[GIZMO_TOTAL_WARNINGS + 5];
- shown = (float)1.0;
- XtSetArg(arg[0], XtNshown, sizeof(float) > sizeof(XtArgVal) ?
- (XtArgVal)&shown : *(XtArgVal *)&shown);
+ shown.f = (float)1.0;
+ XtSetArg(arg[0], XtNshown, shown.xav);
XtSetValues(gptr->widget, arg, 1);
XtAddCallback(gptr->widget, XtNjumpProc, apple_jump, (XtPointer)NULL);
XtAddCallback(gptr->widget, XtNscrollProc, apple_scroll, (XtPointer)NULL);
diff --git a/dialogs.c b/dialogs.c
index 43410b5..9d864e4 100644
--- a/dialogs.c
+++ b/dialogs.c
@@ -87,7 +87,7 @@ ARGSEP Cardinal *argc
for(optr = dialog_options; optr->text; optr ++)
if(!strcmp(optr->text, *argv))
{
- dialog_option(widget, (XtPointer)optr->option, (XtPointer)NULL);
+ dialog_option(widget, (XtPointer)(unsigned long)optr->option, (XtPointer)NULL);
break;
}
return;
@@ -135,7 +135,7 @@ ARGSEP XtPointer call
widget = XtParent(widget);
if(!widget)
/* EMPTY */;
- else if((unsigned)client == DIALOG_CLEAR)
+ else if((unsigned long)client == DIALOG_CLEAR)
{
Widget text;
@@ -160,7 +160,7 @@ ARGSEP XtPointer call
if(dptr->dialog == widget)
{
dptr->selection |=
- (unsigned)client & dptr->options;
+ (unsigned long)client & dptr->options;
if(dptr->selection && dptr->up)
{
dptr->up = 0;
@@ -320,7 +320,7 @@ FUNCARG((root),
if(optr->option & (1 << count))
{
XawDialogAddButton(dptr->dialog, optr->text,
- dialog_option, (XtPointer)(1 << count));
+ dialog_option, (XtPointer)(unsigned long)(1 << count));
break;
}
}
diff --git a/makemred.c b/makemred.c
index 18aa078..ee1f7a1 100644
--- a/makemred.c
+++ b/makemred.c
@@ -492,7 +492,7 @@ ARGSEP String *argv
/* EMPTY */;
display.toplevel = XtAppInitialize(&display.context, "Xmris",
options, (Cardinal)(ptr - options),
- (Cardinal *)&argc, (String *)argv,
+ &argc, (String *)argv,
(String *)fallback_resources,
toplevel_args, XtNumber(toplevel_args));
if(argc > 1)
diff --git a/makemris.c b/makemris.c
index 9ea2bb5..4bf8d20 100644
--- a/makemris.c
+++ b/makemris.c
@@ -282,7 +282,7 @@ ARGSEP String *argv
/* EMPTY */;
display.toplevel = XtAppInitialize(&display.context, "Xmris",
options, (Cardinal)(ptr - options),
- (Cardinal *)&argc, (String *)argv,
+ &argc, (String *)argv,
(String *)NULL, toplevel_args, XtNumber(toplevel_args));
}
if(argc > 1)
@@ -309,7 +309,7 @@ ARGSEP String *argv
/*{{{ some more setup*/
{
XtResource CONST *ptr;
- char CONST *dir;
+ char *dir;
XtAppSetTypeConverter(display.context, XtRString, XtRKeySym,
convert_string2keysym, (XtConvertArgRec *)NULL, 0, XtCacheNone,
diff --git a/menubar.c b/menubar.c
index 616a70c..57db711 100644
--- a/menubar.c
+++ b/menubar.c
@@ -147,7 +147,7 @@ ARGSEP XtPointer call
char CONST *error;
int insert;
- if((unsigned)client == GIZMO_FILE_LOAD - GIZMO_FILE_BASE)
+ if((unsigned long)client == GIZMO_FILE_LOAD - GIZMO_FILE_BASE)
{
if(!check_saved(CHANGED_ANY))
return;
@@ -166,7 +166,7 @@ ARGSEP XtPointer call
dialog = DIALOG_FILE_ERROR;
title = "Cannot load";
menu_filename(result);
- if((unsigned)client == GIZMO_FILE_LOAD - GIZMO_FILE_BASE)
+ if((unsigned long)client == GIZMO_FILE_LOAD - GIZMO_FILE_BASE)
free_descriptors();
error = load_boards(filename, insert);
}
@@ -174,7 +174,7 @@ ARGSEP XtPointer call
break;
}
while(error);
- if((unsigned)client == GIZMO_FILE_LOAD - GIZMO_FILE_BASE)
+ if((unsigned long)client == GIZMO_FILE_LOAD - GIZMO_FILE_BASE)
changed_flag = 0;
return;
}
@@ -234,7 +234,7 @@ ARGSEP XtPointer call
char CONST *error;
XtVaGetValues(widget, XtNlabel, &title, NULL);
- dialog = filename && *filename && (unsigned)client ==
+ dialog = filename && *filename && (unsigned long)client ==
GIZMO_FILE_SAVE - GIZMO_FILE_BASE ? -1 : DIALOG_FILENAME;
error = NULL;
option = DIALOG_NONE;
@@ -475,10 +475,10 @@ FUNCARG((root),
create_gizmos(root, gizmos, XtNumber(gizmos));
for(ix = XtNumber(file_callbacks); ix--;)
XtAddCallback(gizmos[GIZMO_FILE_BASE + ix].widget,
- XtNcallback, file_callbacks[ix], (XtPointer)ix);
+ XtNcallback, file_callbacks[ix], (XtPointer)(unsigned long)ix);
for(ix = XtNumber(garden_callbacks); ix--;)
XtAddCallback(gizmos[GIZMO_GARDEN_BASE + ix].widget,
- XtNcallback, garden_callbacks[ix], (XtPointer)ix);
+ XtNcallback, garden_callbacks[ix], (XtPointer)(unsigned long)ix);
menu_filename(NULL);
menu_total(0);
return;
diff --git a/player.c b/player.c
index 560fb1d..944393f 100644
--- a/player.c
+++ b/player.c
@@ -8,8 +8,8 @@ extern VOIDFUNC bounce_ball FUNCARGVOID
* bouncing the ball is rather involved
*/
{
- COORD tl;
- COORD br;
+ COORD tl = { 0, 0 };
+ COORD br = { 0, 0 };
CELL *cptr;
CELL *optr;
diff --git a/scram.c b/scram.c
index 62546e7..7d34d33 100644
--- a/scram.c
+++ b/scram.c
@@ -113,7 +113,7 @@ ARGSEP BITMAP *bitmap /* bitmap ptr */
FILE *stream;
unsigned state;
char line[128];
- SIZE place;
+ SIZE place = { 0, 0 };
unsigned extra;
stream = fopen(name, "r");
--
1.7.5
0009-Remove-TRANSPUTER-stuff.patch:
common.h | 4 ---
defcom.c | 6 -----
scoring.c | 49 ------------------------------------------
scram.c | 4 ---
timer.c | 71 --------------------------------------------------------------
xmris.c | 2 -
xmris.h | 12 ----------
7 files changed, 148 deletions(-)
--- NEW FILE 0009-Remove-TRANSPUTER-stuff.patch ---
>From 361a5e7c3ebfbbe7fecbdbdd9d5f7497679f3be1 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Fri, 29 Apr 2011 17:17:12 +0200
Subject: [PATCH 09/20] Remove TRANSPUTER stuff
This is not used (never defined by any makefiles) and obfuscates the code
needlessly. Removing this is a preparation step for cleaning up the highscore
support for dropping setgid rights directly on start, rather then using
unsafe seteg/uid tricks.
---
common.h | 4 ---
defcom.c | 6 -----
scoring.c | 49 ------------------------------------------
scram.c | 4 ---
timer.c | 71 -------------------------------------------------------------
xmris.c | 2 -
xmris.h | 11 ---------
7 files changed, 0 insertions(+), 147 deletions(-)
diff --git a/common.h b/common.h
index e1fd8dd..0babbce 100644
--- a/common.h
+++ b/common.h
@@ -16,9 +16,7 @@
#include <errno.h>
#include <ctype.h>
#include <time.h>
-#ifndef TRANSPUTER
#include <unistd.h>
-#endif /* TRANSPUTER */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
@@ -294,9 +292,7 @@ typedef struct Data
Boolean username; /* use username of user */
Boolean nodynamic; /* don't take advantage of dynamic visuals */
Boolean nodisplay; /* don't open the display, even to get X resources */
-#ifndef TRANSPUTER
Boolean busywait; /* do busy waiting */
-#endif /* TRANSPUTER */
#endif /* XMRED */
Boolean gender; /* he or she? */
int distinct; /* distinct colors allocated */
diff --git a/defcom.c b/defcom.c
index 5934c5e..9715fe9 100644
--- a/defcom.c
+++ b/defcom.c
@@ -219,9 +219,7 @@ XrmOptionDescRec options[] =
{"-username",".username", XrmoptionNoArg, (XtPointer)XtEyes},
{"-realname",".username", XrmoptionNoArg, (XtPointer)XtEno},
{"-static", ".static", XrmoptionNoArg, (XtPointer)XtEyes},
-#ifndef TRANSPUTER
{"-busywait", ".busywait", XrmoptionNoArg, (XtPointer)XtEyes},
-#endif /* TRANSPUTER */
#endif /* XMRED */
{NULL}
};
@@ -259,10 +257,8 @@ XtResource resources[] =
XtOffsetOf(DATA, username), XtRImmediate, (XtPointer)False},
{"static", "Static", XtRBoolean, sizeof(Boolean),
XtOffsetOf(DATA, nodynamic), XtRImmediate, (XtPointer)False},
-#ifndef TRANSPUTER
{"busywait", "Busywait", XtRBoolean, sizeof(Boolean),
XtOffsetOf(DATA, busywait), XtRImmediate, (XtPointer)False},
-#endif /* TRANSPUTER */
#endif /* XMRED */
{XtNfont, XtCFont, XtRFont, sizeof(Font),
XtOffsetOf(DATA, font), XtRString, (XtPointer)FONT_NAME},
@@ -394,9 +390,7 @@ HELP CONST help[] =
{"Remove user's scores", "-remove", "", "<name>"},
{"Do not open display", "+display", "", ""},
{"Store date format change", "-format", "", ""},
-#ifndef TRANSPUTER
{"Force busywaiting", "-busywait", "Busywait:yes", ""},
-#endif /* TRANSPUTER */
#endif /* XMRED */
{NULL}
};
diff --git a/scoring.c b/scoring.c
index 6f1030f..b63c2b6 100644
--- a/scoring.c
+++ b/scoring.c
@@ -26,15 +26,11 @@
/*}}}*/
#include "xmris.h"
/*{{{ other includes*/
-#ifdef TRANSPUTER
-#include <iocntrl.h>
-#else
#include <pwd.h>
#include <sys/stat.h>
#ifdef USELOCKFILE
#include <fcntl.h>
#endif /* USELOCKFILE */
-#endif /* TRANSPUTER */
/*}}}*/
/*{{{ file locking*/
#ifndef SYSV
@@ -131,9 +127,6 @@ ARGSEP uid_t uid
* so that we pick up the new scores
*/
{
-#ifdef TRANSPUTER
- return 1; /* assume that it has changed */
-#else
static time_t last_time[2];
struct stat buffer;
unsigned changed;
@@ -151,7 +144,6 @@ ARGSEP uid_t uid
if(real_uid != current_uid)
set_euid((current_uid = real_uid));
return changed;
-#endif /* TRANSPUTER */
}
/*}}}*/
/*{{{ void get_lock(name, flag, uid)*/
@@ -172,34 +164,6 @@ ARGSEP uid_t uid
{
FILE *stream;
-#ifdef TRANSPUTER
- if(locking_file && !locks)
- /*{{{ attempt file lock*/
- {
- unsigned count;
- FILE *lock;
-
- for(count = 3; count; count--)
- {
- lock = fopen(locking_file, "r");
- if(lock)
- {
- fclose(lock);
- sleep(1);
- }
- else
- {
- lock = fopen(locking_file, "w");
- if(lock)
- fclose(lock);
- else
- perror(locking_file);
- break;
- }
- }
- }
- /*}}}*/
-#else
#ifdef USELOCKFILE
if(locking_file && !locks)
/*{{{ attempt exclusive file lock*/
@@ -235,7 +199,6 @@ ARGSEP uid_t uid
#endif /* USELOCKFILE */
if(uid != current_uid)
set_euid((current_uid = uid));
-#endif /* TRANSPUTER */
stream = fopen(name, flag & 1 ? "w+" : "r+");
if(!stream && !(flag & 2))
perror(name);
@@ -244,10 +207,8 @@ ARGSEP uid_t uid
locks++;
else if(locking_file && !locks)
{
-#ifndef TRANSPUTER
if(current_uid != effective_uid)
set_euid((current_uid = effective_uid));
-#endif /* TRANSPUTER */
unlink(locking_file);
}
#else
@@ -260,12 +221,10 @@ ARGSEP uid_t uid
}
/*}}}*/
#endif /* USELOCKFILE */
-#ifndef TRANSPUTER
if(stream && flag & 4 && effective_uid == real_uid)
chmod(name, 0666); /* not everyone has fchmod */
if(current_uid != real_uid)
set_euid((current_uid = real_uid));
-#endif /* TRANSPUTER */
return stream;
}
/*}}}*/
@@ -284,15 +243,11 @@ FUNCARG((stream),
locks--;
if(locking_file && locks)
{
-#ifndef TRANSPUTER
if(current_uid != effective_uid)
set_euid((current_uid = effective_uid));
-#endif
unlink(locking_file);
-#ifndef TRANSPUTER
if(current_uid != real_uid)
set_euid((current_uid = real_uid));
-#endif /* TRANSPUTER */
}
#else
rewind(stream);
@@ -342,7 +297,6 @@ extern VOIDFUNC init_scores FUNCARGVOID
user = NULL;
home = NULL;
reallife = NULL;
-#ifndef TRANSPUTER
/*{{{ read passwd information*/
{
struct passwd *ptr;
@@ -409,7 +363,6 @@ extern VOIDFUNC init_scores FUNCARGVOID
}
}
/*}}}*/
-#endif
scoring.mine.score = 0;
/*{{{ set username*/
{
@@ -720,7 +673,6 @@ FUNCARG((insert),
personal = 0;
truename = home = NULL;
-#ifndef TRANSPUTER
/*{{{ find name & home*/
{
struct passwd *ptr;
@@ -733,7 +685,6 @@ FUNCARG((insert),
}
}
/*}}}*/
-#endif /* TRANSPUTER */
/*{{{ search*/
for(found = index = 0; index != 2; index++)
{
diff --git a/scram.c b/scram.c
index 7d34d33..d68cf03 100644
--- a/scram.c
+++ b/scram.c
@@ -25,11 +25,7 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#ifdef TRANSPUTER
-#include <iocntrl.h>
-#else
#include <unistd.h>
-#endif /* TRANSPUTER */
/*}}}*/
#define SUFFIXMONO ".bw"
#define SUFFIXCOLOR ".rgb"
diff --git a/timer.c b/timer.c
index c8fa2c1..028f8f0 100644
--- a/timer.c
+++ b/timer.c
@@ -54,12 +54,8 @@
*/
/*}}}*/
#include "xmris.h"
-#ifdef TRANSPUTER
-#include <process.h>
-#else
#include <sys/time.h>
#include <signal.h>
-#endif
#ifdef SVR4
#ifndef SYSV
#define SYSV
@@ -74,7 +70,6 @@
* reblocks the signal
* signal_release returns the block mask to what it was before signal_hold
*/
-#ifndef TRANSPUTER
#if defined POSIX || defined linux
# define MASK sigset_t
# define signal_hold(signal, maskp) \
@@ -125,7 +120,6 @@
# endif /* SYSV */
# endif /* __hpux */
#endif /* POSIX */
-#endif /* TRANSPUTER */
/*}}}*/
/*{{{ get current time*/
/* TICKTIME specifies how many microseconds in each timer tick
@@ -133,14 +127,6 @@
* BUSYWAIT is set if the timer is precise enough for busywait code
* to work
*/
-#ifdef TRANSPUTER
-# define gettick(ptr) (*(ptr) = ProcTime())
-# define TICKTIME (unsigned long)64
-# define tickdelta(later, earlier) ProcTimeMinus(later, earlier)
-# define tickafter(later, earlier) ProcTimerAfter(later, earlier)
-# define tickadd(time, interval) ProcTimePlus(time, interval)
- typedef int tick_t;
-#else
# ifdef USETIME
# define gettick(ptr) (*(ptr) = time((time_t *)NULL))
# define TICKTIME (unsigned long)1000000
@@ -181,17 +167,12 @@
(tickdelta(later, earlier) < ~(~(unsigned long)0 >> 1))
typedef unsigned long tick_t;
# endif /* USETIME */
-#endif /* TRANSPUTER */
/*}}}*/
/*{{{ timer*/
static struct
{
VOIDFUNC (*handler) PROTOARG((int)); /* original handler */
unsigned long usec; /* interval time in usec */
-#ifdef TRANSPUTER
- tick_t delay; /* tickdelay waiting */
- tick_t timeout; /* when the next one should timeout */
-#else
struct itimerval interval; /* internal interval time */
unsigned VOLATILE elapsed; /* timer elapsed */
unsigned VOLATILE waiting; /* waiting for the interrupt */
@@ -201,7 +182,6 @@ static struct
tick_t timeout; /* timeout */
tick_t delay; /* interval delay */
#endif /* BUSYWAIT */
-#endif /* TRANSPUTER */
unsigned state; /* timing state */
tick_t game; /* start of game tick */
tick_t start; /* timing start */
@@ -226,26 +206,11 @@ static unsigned next;
/*}}}*/
#endif
/*{{{ prototypes*/
-#ifndef TRANSPUTER
static VOIDFUNC timer_alarm PROTOARG((int));
-#endif /* TRANSPUTER */
#ifndef NDEBUG
static VOIDFUNC timer_debug PROTOARG((char CONST *));
#endif
/*}}}*/
-#ifdef TRANSPUTER
-/*{{{ void sleep(delay)*/
-extern VOIDFUNC sleep
-FUNCARG((delay),
- unsigned delay
-)
-{
- ProcWait((int)(delay * (1000000 / TICKTIME)));
- return;
-}
-/*}}}*/
-#endif /* TRANSPUTER */
-#ifndef TRANSPUTER
/*{{{ void timer_alarm(sig)*/
static VOIDFUNC timer_alarm
/* ARGSUSED */
@@ -297,14 +262,12 @@ FUNCARG((sig),
return;
}
/*}}}*/
-#endif /* TRANSPUTER */
/*{{{ void timer_close()*/
extern VOIDFUNC timer_close FUNCARGVOID
/*
* closes the timer stuff
*/
{
-#ifndef TRANSPUTER
if(data.busywait == False)
{
MASK mask;
@@ -322,7 +285,6 @@ extern VOIDFUNC timer_close FUNCARGVOID
signal(SIGALRM, timer.handler);
#endif /* USESIGSET */
}
-#endif /* TRANSPUTER */
return;
}
/*}}}*/
@@ -354,10 +316,6 @@ extern VOIDFUNC timer_open FUNCARGVOID
* and starting the first tick
*/
{
-#ifdef TRANSPUTER
- assert(ProcGetPriority());
- gettick(&timer.timeout);
-#else
if(data.busywait != False)
# ifdef BUSYWAIT
{
@@ -382,7 +340,6 @@ extern VOIDFUNC timer_open FUNCARGVOID
#endif /* USESIGSET */
timer.waiting = 0;
timer.elapsed = 1;
-#endif /* TRANSPUTER */
#ifndef NDEBUG
timer_debug("Init");
#endif
@@ -418,14 +375,10 @@ ARGSEP unsigned state
assert(t1 || t2);
}
timer.usec = tick;
-#ifdef TRANSPUTER
- timer.delay = (tick_t)(tick / TICKTIME);
-#else
#ifdef BUSYWAIT
timer.delay = (tick_t)(tick / TICKTIME);
#endif /* BUSYWAIT */
timer.interval.it_value.tv_usec = tick;
-#endif /* TRASNPUTER */
}
value = timer.state;
switch(state)
@@ -501,27 +454,6 @@ extern VOIDFUNC timer_wait FUNCARGVOID
{
int point;
-#ifdef TRANSPUTER
- /*{{{ wait for it*/
- {
- tick_t now;
-
- gettick(&now);
- if(timeafter(now, timer.timeout))
- {
- point = 1;
- timer.timeout = now;
- timer.missed++;
- }
- else
- {
- point = -1;
- ProcAfter(timer.timeout);
- }
- timer.timeout = tickadd(timer.timeout, timer.delay);
- }
- /*}}}*/
-#else
{
MASK mask;
@@ -585,7 +517,6 @@ extern VOIDFUNC timer_wait FUNCARGVOID
}
/*}}}*/
#endif /* BUSYWAIT */
-#endif /* TRANSPUTER */
if(timer.state != TIMING_ON)
/* EMPTY */;
else if(!timer.count)
@@ -603,7 +534,6 @@ extern VOIDFUNC timer_wait FUNCARGVOID
usec = (unsigned long)tickdelta(timer.stop, timer.start) * TICKTIME;
dilation = (unsigned)(usec / FRAME_RATIO_UPDATE *
FRAME_SCALE / timer.usec);
-#ifndef TRANSPUTER
#ifdef BUSYWAIT
if(!timer.busywait && dilation * 100 < FRAME_SCALE * 97)
{
@@ -613,7 +543,6 @@ extern VOIDFUNC timer_wait FUNCARGVOID
timer.busywait = 1;
}
#endif /* BUSYWAIT */
-#endif /* TRANSPUTER */
if(dilation <= FRAME_SCALE)
dilation = FRAME_SCALE;
else if(timer.missed <= (global.dilation == FRAME_SCALE ?
diff --git a/xmris.c b/xmris.c
index 2f6cc62..d79815a 100644
--- a/xmris.c
+++ b/xmris.c
@@ -1260,13 +1260,11 @@ ARGSEP char CONST **argv
Atom wm_delete_window;
myname = *argv ? *argv : "Xmris";
-#ifndef TRANSPUTER
real_uid = getuid();
effective_uid = geteuid();
if(real_uid != effective_uid)
set_euid(real_uid);
current_uid = real_uid;
-#endif /* TRANSPUTER */
open_toolkit(argc, (String *)argv);
init_scores();
/*{{{ help?*/
diff --git a/xmris.h b/xmris.h
index ac4fd50..9918502 100644
--- a/xmris.h
+++ b/xmris.h
@@ -13,25 +13,17 @@
#define FUNCANIMATE(name, arg) PROTOVOID(*name(arg)) PROTOVOID(*arg);
#endif
/*}}}*/
-#ifdef TRANSPUTER
-#undef USELOCKFILE
-#define USELOCKFILE
-#endif /* TRANSPUTER */
/*{{{ check score*/
#ifndef SCORE_DIR
#error No default score directory
#endif /* SCORE_DIR */
/*}}}*/
/*{{{ set_euid*/
-#ifdef TRANSPUTER
-typedef int uid_t;
-#else
#ifdef __hpux
#define set_euid(euid) setresuid((uid_t)-1, euid, (uid_t)-1)
#else
#define set_euid(euid) seteuid(euid)
#endif /* __hpux */
-#endif /* TRANSPUTER */
/*}}}*/
/*{{{ defines*/
/*{{{ board sizes*/
@@ -564,9 +556,6 @@ extern VOIDFUNC high_score PROTOARG((unsigned long, unsigned, unsigned long));
extern VOIDFUNC init_scores PROTOARG((VOIDARG));
/*}}}*/
/*{{{ timer*/
-#ifdef TRANSPUTER
-extern VOIDFUNC sleep PROTOARG((unsigned));
-#endif /* TRANSPUTER */
extern VOIDFUNC timer_close PROTOARG((VOIDARG));
extern VOIDFUNC timer_open PROTOARG((VOIDARG));
extern unsigned timer_set PROTOARG((unsigned long, unsigned));
--
1.7.5
0010-Remove-USELOCKFILE-stuff.patch:
Imakefile | 5 --
Makefile.std | 5 --
scoring.c | 102 -----------------------------------------------------------
xmris.man | 15 --------
4 files changed, 3 insertions(+), 124 deletions(-)
--- NEW FILE 0010-Remove-USELOCKFILE-stuff.patch ---
>From 4f1962e509a1338bd607937b6e55f9a82023d6ba Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Fri, 29 Apr 2011 17:19:05 +0200
Subject: [PATCH 10/20] Remove USELOCKFILE stuff
Removing this is a preparation step for cleaning up the highscore
support for dropping setgid rights directly on start, rather then using
unsafe seteg/uid tricks. In this mode using a separate lockfile is not
supported.
---
Imakefile | 5 +--
Makefile.std | 5 +--
scoring.c | 102 ----------------------------------------------------------
xmris.man | 14 +-------
4 files changed, 3 insertions(+), 123 deletions(-)
diff --git a/Imakefile b/Imakefile
index a6c6842..ad062d7 100644
--- a/Imakefile
+++ b/Imakefile
@@ -59,9 +59,6 @@ XCOMM
XCOMM don't you have gettimeofday?
TIME =
XCOMM TIME = -DUSETIME
-XCOMM don't you have lockf or flock?
-LOCK =
-XCOMM LOCK = -DUSELOCKFILE
XCOMM game defaults, you probably only want to alter the SCORE
XCOMM
@@ -121,7 +118,7 @@ FONT = thefont
#endif
DEFINES = $(EXTRACCOPTIONS) -DFONT_NAME='$(FONT)' $(NDEBUG) \
- -DSCORE_DIR='"$(SCORE)"' $(LOCK) $(TIME) $(KNR) -DSCROLLBARBUGFIX
+ -DSCORE_DIR='"$(SCORE)"' $(TIME) $(KNR) -DSCROLLBARBUGFIX
LOCAL_LIBRARIES = $(XAWLIB) $(XTOOLLIB) $(XMULIB) $(XINTL) $(XLIB) $(MATHSLIB)
DEPLIBS = $(DEPXLIB)
diff --git a/Makefile.std b/Makefile.std
index 72d1ba9..39b8935 100644
--- a/Makefile.std
+++ b/Makefile.std
@@ -434,9 +434,6 @@ KNR =
# don't you have gettimeofday?
TIME =
# TIME = -DUSETIME
-# don't you have lockf or flock?
-LOCK =
-LOCK = -DUSELOCKFILE
# game defaults, you probably only want to alter the SCORE
#
@@ -488,7 +485,7 @@ COFLAGS = -l
RCSFLAGS =
DEFINES = $(EXTRACCOPTIONS) -DFONT_NAME='$(FONT)' $(NDEBUG) \
- -DSCORE_DIR='"$(SCORE)"' $(LOCK) $(TIME) $(KNR) -DSCROLLBARBUGFIX
+ -DSCORE_DIR='"$(SCORE)"' $(TIME) $(KNR) -DSCROLLBARBUGFIX
LOCAL_LIBRARIES = $(XAWLIB) $(XTOOLLIB) $(XMULIB) $(XLIB) $(MATHSLIB)
DEPLIBS = $(DEPXLIB)
diff --git a/scoring.c b/scoring.c
index b63c2b6..015dd43 100644
--- a/scoring.c
+++ b/scoring.c
@@ -1,36 +1,8 @@
/* Copyright (C) 1993, 1992 Nathan Sidwell */
-/* RCS $Id: scoring.c 1.2 Tue, 16 Mar 1999 11:28:16 +0000 nathan $ */
-/*{{{ file locking problems*/
-/*
- * USELOCKFILE file locking as suggested by
- * Daniel Edward Lovinger <del+(a)cmu.edu>
- * With lockf (or flock), we just use the kernel's locking stuff to lock the
- * entire score file while we read, or update it. But some distributed
- * file systems don't support it and some are broken (SunOS 4.1).
- * USELOCKFILE uses uses open(O_CREAT | O_EXCL) to create
- * a lock file in the same directory as the xmris high score file, with
- * the name "xmris.lock".
- * The personal score files are either in the score file directory
- * with names "xmris-<name>", or in the user's home directory with name
- * ".xmris.scores".
- * In order to work correctly, if xmris is set_euid'd to get the access
- * permissions to the high score directory, we keep juggling
- * the effective user id between the set_euid'd one and the real uid.
- * This ensures that xmris can open the display on servers which use
- * magic cookie and access control (like openwindows), and that the
- * personal file has the correct attributes when created in the user's
- * home directory.
- *
- * Some systems have flock (BSD), and some have lockf (SYSV).
- */
-/*}}}*/
#include "xmris.h"
/*{{{ other includes*/
#include <pwd.h>
#include <sys/stat.h>
-#ifdef USELOCKFILE
-#include <fcntl.h>
-#endif /* USELOCKFILE */
/*}}}*/
/*{{{ file locking*/
#ifndef SYSV
@@ -53,10 +25,6 @@ static int personal_make = 2;
static uid_t personal_uid = -1; /* uid for personal file */
static char date_format[4] = " ";
static char *alternate = NULL; /* alternative name */
-#ifdef USELOCKFILE
-static char *locking_file = NULL; /* lock file name */
-static unsigned locks; /* number of locks open */
-#endif /* USELOCKFILE */
static HIGH_SCORE *CONST tables[] =
{scoring.high, scoring.today, scoring.personal};
/*}}}*/
@@ -164,54 +132,11 @@ ARGSEP uid_t uid
{
FILE *stream;
-#ifdef USELOCKFILE
- if(locking_file && !locks)
- /*{{{ attempt exclusive file lock*/
- {
- unsigned count;
- int filed;
-
- for(count = 3; count;)
- {
- if(current_uid != effective_uid)
- set_euid((current_uid = effective_uid));
- filed = open(locking_file, O_CREAT | O_EXCL, 0666);
- if(filed >= 0)
- break;
- if(errno == EINTR)
- continue;
- else if(errno == EEXIST)
- {
- sleep(1);
- if(!file_changed(name, uid))
- count--;
- }
- else
- {
- perror(locking_file);
- break;
- }
- }
- if(filed >= 0)
- close(filed);
- }
- /*}}}*/
-#endif /* USELOCKFILE */
if(uid != current_uid)
set_euid((current_uid = uid));
stream = fopen(name, flag & 1 ? "w+" : "r+");
if(!stream && !(flag & 2))
perror(name);
-#ifdef USELOCKFILE
- if(stream)
- locks++;
- else if(locking_file && !locks)
- {
- if(current_uid != effective_uid)
- set_euid((current_uid = effective_uid));
- unlink(locking_file);
- }
-#else
if(stream)
/*{{{ get lock on the file*/
while(lock_file(stream))
@@ -220,7 +145,6 @@ ARGSEP uid_t uid
continue;
}
/*}}}*/
-#endif /* USELOCKFILE */
if(stream && flag & 4 && effective_uid == real_uid)
chmod(name, 0666); /* not everyone has fchmod */
if(current_uid != real_uid)
@@ -238,22 +162,9 @@ FUNCARG((stream),
*/
{
fflush(stream);
-#ifdef USELOCKFILE
- fclose(stream);
- locks--;
- if(locking_file && locks)
- {
- if(current_uid != effective_uid)
- set_euid((current_uid = effective_uid));
- unlink(locking_file);
- if(current_uid != real_uid)
- set_euid((current_uid = real_uid));
- }
-#else
rewind(stream);
unlock_file(stream);
fclose(stream);
-#endif /* USELOCKFILE */
return;
}
/*}}}*/
@@ -394,19 +305,6 @@ extern VOIDFUNC init_scores FUNCARGVOID
dirlen = data.dir ? strlen(data.dir) : 0;
if(dirlen && data.dir[dirlen - 1] == '/')
dirlen--;
-#ifdef USELOCKFILE
- /*{{{ lock file?*/
- if(dirlen)
- {
- locking_file = malloc(dirlen + 12);
- if(locking_file)
- {
- strcpy(locking_file, data.dir);
- strcpy(&locking_file[dirlen], "/xmris.lock");
- }
- }
- /*}}}*/
-#endif /* USELOCKFILE */
/*{{{ score directory?*/
if(dirlen)
{
diff --git a/xmris.man b/xmris.man
index 1e7c47f..fab41d3 100644
--- a/xmris.man
+++ b/xmris.man
@@ -866,14 +866,6 @@ file to 666 if creating it.
.br
.ne 3
.TP
-.B .../xmris.lock
-In some systems, where lockf or flock doesn't work, this temporary file
-is used to perform the locking. The directory containing it must be
-writable by Mr Is. This can be done by chmoding the directory, or
-by setuiding Mr Is appropriately.
-.br
-.ne 4
-.TP
.PD 0
.B .../xmris-<name>
.TP
@@ -888,7 +880,7 @@ to move it to the score directory. Mr Is
will attempt to create the personal files in the score directory. If this
cannot be done, the personal score file is placed in the home directory. In
order to create the personal score file in the score directory, Mr Is will
-have to have the correct access rights, as with the lock file. A setuid Mr Is
+have to have the correct access rights. A setuid Mr Is
will juggle the effective uid correctly for accessing both the score directory
and the users' home directories.
.br
@@ -923,10 +915,6 @@ Some of the garden files.
.BR xmred (6)
.SH ERRORS
.PP
-If you use a lock file, rather than lockf, and an error occurs
-creating the lock file, a message is printed on stderr, and file
-locking is not done for that access. Subsequent accesses may be alright.
-.PP
If an error occurs opening the score file, a message is printed on
stderr, and the score file is disabled. Personal score files will
be generated in the users' home directories.
--
1.7.5
0011-Remove-seteuid-stuff.patch:
scoring.c | 60 ++++++++++++++++++++++--------------------------------------
xmris.c | 5 -----
xmris.h | 10 ----------
xmris.man | 20 +++++---------------
4 files changed, 27 insertions(+), 68 deletions(-)
--- NEW FILE 0011-Remove-seteuid-stuff.patch ---
>From da2715a3b82134d118b032a1db06881d128b564b Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Fri, 29 Apr 2011 17:52:33 +0200
Subject: [PATCH 11/20] Remove seteuid stuff
Removing this is a preparation step for cleaning up the highscore
support for dropping setgid rights directly on start, rather then using
unsafe seteg/uid tricks.
---
scoring.c | 60 ++++++++++++++++++++++--------------------------------------
xmris.c | 5 -----
xmris.h | 10 ----------
xmris.man | 19 +++++--------------
4 files changed, 27 insertions(+), 67 deletions(-)
diff --git a/scoring.c b/scoring.c
index 015dd43..ede2f07 100644
--- a/scoring.c
+++ b/scoring.c
@@ -22,7 +22,6 @@ static char *score_file = NULL; /* high score file name */
static char *personal_file = NULL; /* personal in high score dir */
static char *personal_home = NULL; /* personal in home dir */
static int personal_make = 2;
-static uid_t personal_uid = -1; /* uid for personal file */
static char date_format[4] = " ";
static char *alternate = NULL; /* alternative name */
static HIGH_SCORE *CONST tables[] =
@@ -30,8 +29,8 @@ static HIGH_SCORE *CONST tables[] =
/*}}}*/
/*{{{ prototypes*/
static unsigned expire PROTOARG((time_t, time_t));
-static unsigned file_changed PROTOARG((char CONST *, uid_t));
-static FILE *get_lock PROTOARG((char CONST *, unsigned, uid_t));
+static unsigned file_changed PROTOARG((char CONST *));
+static FILE *get_lock PROTOARG((char CONST *, unsigned));
static VOIDFUNC get_unlock PROTOARG((FILE *));
static unsigned insert_personal PROTOARG((HIGH_SCORE CONST *));
static unsigned insert_score
@@ -53,9 +52,9 @@ static unsigned long write_table
extern VOIDFUNC check_scores FUNCARGVOID
{
retire_scores();
- if((score_file && file_changed(score_file, effective_uid)) ||
+ if((score_file && file_changed(score_file)) ||
(!personal_make && personal_file &&
- file_changed(personal_file, personal_uid)))
+ file_changed(personal_file)))
load_check_expire_insert(0);
return;
}
@@ -84,11 +83,10 @@ ARGSEP time_t then
then_hour >= 21 && now_hour < 12));
}
/*}}}*/
-/*{{{ void file_changed(name, uid)*/
+/*{{{ void file_changed(name)*/
static unsigned file_changed
-FUNCARG((name, uid),
+FUNCARG((name),
char CONST *name
-ARGSEP uid_t uid
)
/*
* check if a score file has been changed since last I looked,
@@ -100,8 +98,6 @@ ARGSEP uid_t uid
unsigned changed;
assert(name);
- if(uid != current_uid)
- set_euid((current_uid = uid));
if(!stat(name, &buffer))
{
changed = buffer.st_mtime != last_time[name == score_file];
@@ -109,31 +105,24 @@ ARGSEP uid_t uid
}
else
changed = 0;
- if(real_uid != current_uid)
- set_euid((current_uid = real_uid));
return changed;
}
/*}}}*/
-/*{{{ void get_lock(name, flag, uid)*/
+/*{{{ void get_lock(name, flag)*/
static FILE *get_lock
-FUNCARG((name, flag, uid),
+FUNCARG((name, flag),
char CONST *name
ARGSEP unsigned flag
-ARGSEP uid_t uid
)
/*
* open and locks a high score file
* flag & 1 == 0 -> "r+"
* flag & 1 != 0 -> "w+"
* flag & 2 inhibit error message
- * flag & 4 && effective_uid == real_uid set chmod 666
- * uid required to access
*/
{
FILE *stream;
- if(uid != current_uid)
- set_euid((current_uid = uid));
stream = fopen(name, flag & 1 ? "w+" : "r+");
if(!stream && !(flag & 2))
perror(name);
@@ -145,10 +134,6 @@ ARGSEP uid_t uid
continue;
}
/*}}}*/
- if(stream && flag & 4 && effective_uid == real_uid)
- chmod(name, 0666); /* not everyone has fchmod */
- if(current_uid != real_uid)
- set_euid((current_uid = real_uid));
return stream;
}
/*}}}*/
@@ -212,7 +197,7 @@ extern VOIDFUNC init_scores FUNCARGVOID
{
struct passwd *ptr;
- ptr = getpwuid(real_uid);
+ ptr = getpwuid(getuid());
if(ptr)
{
user = ptr->pw_name;
@@ -344,7 +329,6 @@ extern VOIDFUNC init_scores FUNCARGVOID
}
}
/*}}}*/
- personal_uid = effective_uid;
if(data.expire || data.format || data.remove)
data.scores = True;
load_check_expire_insert(0);
@@ -448,7 +432,7 @@ FUNCARG((insert),
/*{{{ score_file?*/
if(score_file)
{
- score_stream = get_lock(score_file, 2, effective_uid);
+ score_stream = get_lock(score_file, 2);
if(score_stream)
do_score = merge_scores(score_stream);
else
@@ -458,7 +442,7 @@ FUNCARG((insert),
/*{{{ personal_file?*/
if(personal_file)
{
- personal_stream = get_lock(personal_file, personal_make, personal_uid);
+ personal_stream = get_lock(personal_file, personal_make);
if(personal_stream)
{
personal_make = 0;
@@ -473,7 +457,7 @@ FUNCARG((insert),
/*{{{ personal_home?*/
if(personal_home)
{
- home_stream = get_lock(personal_home, 2, real_uid);
+ home_stream = get_lock(personal_home, 2);
if(home_stream)
{
merge_personal(home_stream);
@@ -482,7 +466,6 @@ FUNCARG((insert),
personal_file = personal_home;
personal_home = NULL;
personal_make = 0;
- personal_uid = real_uid;
}
else
do_personal = 1;
@@ -534,10 +517,12 @@ FUNCARG((insert),
}
/*}}}*/
/* expire person? */
- if(effective_uid != real_uid)
+ if(getuid() != 0)
{
- if(data.remove || data.format)
- fprintf(stderr, "Not owner");
+ if(data.remove)
+ fprintf(stderr, "Removing a person can only be done by root");
+ if(data.format)
+ fprintf(stderr, "Changing the date format can only be done by root");
data.remove = data.format = NULL;
}
else
@@ -1010,7 +995,7 @@ FUNCARG((insert),
{
if(!score_stream && score_file)
{
- score_stream = get_lock(score_file, 5, effective_uid);
+ score_stream = get_lock(score_file, 5);
if(!score_stream)
score_file = NULL;
}
@@ -1022,7 +1007,7 @@ FUNCARG((insert),
if(do_personal)
{
if(!personal_stream && score_stream && personal_file)
- personal_stream = get_lock(personal_file, 3, personal_uid);
+ personal_stream = get_lock(personal_file, 3);
if(personal_stream)
{
write_personal(personal_stream);
@@ -1033,12 +1018,11 @@ FUNCARG((insert),
else
{
if(!home_stream)
- home_stream = get_lock(personal_home, 1, real_uid);
+ home_stream = get_lock(personal_home, 1);
if(home_stream)
write_personal(home_stream);
else
personal_home = NULL;
- personal_uid = real_uid;
personal_file = personal_home;
personal_home = NULL;
}
@@ -1052,9 +1036,9 @@ FUNCARG((insert),
if(score_stream)
get_unlock(score_stream);
if(do_score && score_file)
- file_changed(score_file, effective_uid);
+ file_changed(score_file);
if(do_personal && personal_file)
- file_changed(personal_file, personal_uid);
+ file_changed(personal_file);
return;
}
/*}}}*/
diff --git a/xmris.c b/xmris.c
index d79815a..b1a0404 100644
--- a/xmris.c
+++ b/xmris.c
@@ -1260,11 +1260,6 @@ ARGSEP char CONST **argv
Atom wm_delete_window;
myname = *argv ? *argv : "Xmris";
- real_uid = getuid();
- effective_uid = geteuid();
- if(real_uid != effective_uid)
- set_euid(real_uid);
- current_uid = real_uid;
open_toolkit(argc, (String *)argv);
init_scores();
/*{{{ help?*/
diff --git a/xmris.h b/xmris.h
index 9918502..1802e87 100644
--- a/xmris.h
+++ b/xmris.h
@@ -18,13 +18,6 @@
#error No default score directory
#endif /* SCORE_DIR */
/*}}}*/
-/*{{{ set_euid*/
-#ifdef __hpux
-#define set_euid(euid) setresuid((uid_t)-1, euid, (uid_t)-1)
-#else
-#define set_euid(euid) seteuid(euid)
-#endif /* __hpux */
-/*}}}*/
/*{{{ defines*/
/*{{{ board sizes*/
#define KNOCK_THROUGH /* how far we go to knock through a new cell */\
@@ -355,9 +348,6 @@ EXTERN struct
unsigned pressed; /* keys we had pressed */
} player;
/*}}}*/
-EXTERN uid_t real_uid; /* who I really am */
-EXTERN uid_t effective_uid; /* who I'm pretending to be */
-EXTERN uid_t current_uid; /* who I currently am */
EXTERN CELL garden[(CELLS_DOWN + CELL_TOP * 2) * CELL_STRIDE];
/*{{{ global*/
EXTERN struct
diff --git a/xmris.man b/xmris.man
index fab41d3..3fe5028 100644
--- a/xmris.man
+++ b/xmris.man
@@ -277,13 +277,9 @@ to use the -dir option too.
.ne 3
.TP
.B \-remove \fIname\fP
-Allows the game's owner to remove someone's scores. The option will only
-work when the real and effective user ids are the same. (ie
-a setuid Mr Is has been run by its owner). After updating the files,
+Allows root to remove someone's scores. After updating the files,
the score tables are listed, and the game does not start. An X display
-will still need to be opened, to read the X resources, which may override
-the default score directory. The +display option may be used to prevent
-this.
+will still be opened. The +display option may be used to prevent this.
.br
.ne 3
.TP
@@ -324,7 +320,7 @@ and a warning is given. The following are valid unambiguous dates, '11jun93'
.ne 3
.TP
.B \-format \fIformat\fP
-Allows the game's owner to set the date format which is stored with the
+Allows root to set the date format which is stored with the
score file, for future use disambiguating dates. The format is
automatically stored if none is set. The format must be a three character
string containing one each of 'D', 'M' and 'Y'.
@@ -859,10 +855,7 @@ following names.
The high score file. The directory is system dependent, and may be
changed by application resource or option.
This file must either exist and be writable to by Mr Is, or the
-directory containing it must be writable by Mr Is. This
-can be done by chmoding the score file or directory, or by
-setuiding Mr Is appropriately. A non-setuid Mr Is will chmod the score
-file to 666 if creating it.
+directory containing it must be writable by Mr Is.
.br
.ne 3
.TP
@@ -880,9 +873,7 @@ to move it to the score directory. Mr Is
will attempt to create the personal files in the score directory. If this
cannot be done, the personal score file is placed in the home directory. In
order to create the personal score file in the score directory, Mr Is will
-have to have the correct access rights. A setuid Mr Is
-will juggle the effective uid correctly for accessing both the score directory
-and the users' home directories.
+have to have the correct access rights.
.br
.ne 5
.TP
--
1.7.5
0012-Drop-dir-option.patch:
Imakefile | 33 +++------------------------------
Makefile.std | 35 +++--------------------------------
README | 10 ----------
Xmris-ad.src | 1 -
common.h | 1 -
defcom.c | 5 -----
draw.c | 4 ----
makemris.c | 6 ------
scoring.c | 15 ++++++---------
xmris.h | 8 --------
xmris.man | 29 +++++------------------------
11 files changed, 17 insertions(+), 130 deletions(-)
--- NEW FILE 0012-Drop-dir-option.patch ---
>From ff2baedb64e331b3a3742be72461d37307257c11 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Sat, 30 Apr 2011 12:43:03 +0200
Subject: [PATCH 12/20] Drop -dir option
Allowing the user to specify the directory in which files will be created
using elevated rights, seems like a bad idea.
---
Imakefile | 33 +++------------------------------
Makefile.std | 35 +++--------------------------------
README | 10 ----------
Xmris-ad.src | 1 -
common.h | 1 -
defcom.c | 5 -----
draw.c | 4 ----
makemris.c | 6 ------
scoring.c | 15 ++++++---------
xmris.h | 8 --------
xmris.man | 28 +++++-----------------------
11 files changed, 17 insertions(+), 129 deletions(-)
diff --git a/Imakefile b/Imakefile
index ad062d7..dcf93c8 100644
--- a/Imakefile
+++ b/Imakefile
@@ -60,13 +60,10 @@ XCOMM don't you have gettimeofday?
TIME =
XCOMM TIME = -DUSETIME
-XCOMM game defaults, you probably only want to alter the SCORE
+XCOMM game defaults, you probably do not want to alter these
XCOMM
/* You must specify a fixed width font that exists. */
/* #define thefont "-*-courier-*-r-*-*-18-*-*-*-m-*-*-*" */
-XCOMM where is the high score file?
-XCOMM SCORE = $(LOCAL)/lib/$(APP)
-SCORE = /var/games/$(APP)
/* to install default gardens not in /usr/share/$(APP) */
/* #define InstallDefaultGardens $(DESTDIR)/usr/share/$(APP) */
@@ -90,14 +87,10 @@ XCOMM owner and access rights for executable & score directory
XCOMM these are set for a setuid xmris
XCOMM OWNER = -o games
OWNER =
-INSTSCOREFLAGS = $(OWNER) -m 755
INSTMRISFLAGS = $(OWNER) $(INSTUIDFLAGS)
XCOMM normal install locations
THEBINDIR = $(BINDIR)
THEMANDIR = $(MANDIR)
-XCOMM for open access you want 777 and $(INSTPGMFLAGS),
-XCOMM (the personal score files go in users' home dirs.)
-XCOMM INSTSCOREFLAGS = -m 777
XCOMM INSTMRISFLAGS = $(INSTPGMFLAGS)
XCOMM If you're not installing in the default locations
XCOMM DESTDIR =
@@ -118,7 +111,7 @@ FONT = thefont
#endif
DEFINES = $(EXTRACCOPTIONS) -DFONT_NAME='$(FONT)' $(NDEBUG) \
- -DSCORE_DIR='"$(SCORE)"' $(TIME) $(KNR) -DSCROLLBARBUGFIX
+ $(TIME) $(KNR) -DSCROLLBARBUGFIX
LOCAL_LIBRARIES = $(XAWLIB) $(XTOOLLIB) $(XMULIB) $(XINTL) $(XLIB) $(MATHSLIB)
DEPLIBS = $(DEPXLIB)
@@ -260,24 +253,7 @@ XCOMM application resource files
InstallAppDefaults(Xmris)
Xmris.ad : Xmris-ad.src
- sed -e 's@SCORE@$(SCORE)@' -e s@FONT@$(FONT)@ < Xmris-ad.src > Xmris.ad
-
-XCOMM score directory install
-install ::
- MakeDir($(SCORE))
- @#not all $(INSTALL) have a -d flag, have to do it explicitly
- @echo installing $(INSTSCOREFLAGS) $(SCORE)
- @set -- $(INSTSCOREFLAGS) ; \
- while [ $$# -ne 0 ] ; \
- do \
- case "$$1" in \
- "-o") shift ; chown $$1 $(SCORE) ; echo owner is $$1 ;; \
- "-m") shift ; chmod $$1 $(SCORE) ;; \
- "-g") shift ; chgrp $$1 $(SCORE) ; echo group is $$1 ;; \
- *) echo unknown option '$$1' ;; \
- esac ; \
- shift ; \
- done
+ sed -e s@FONT@$(FONT)@ < Xmris-ad.src > Xmris.ad
#ifdef InstallDefaultGardens
XCOMM install default gardens
@@ -848,9 +824,6 @@ initialize :
@if [ `ls -t Makefile Imakefile | sed '2,$$d'` = Imakefile ] ; then \
echo Warning:Makefile is older than Imakefile ; \
fi
- @if [ ! -d `echo '$(SCORE)' | sed 's=/[^/]*$$=='` ] ; then \
- echo The parent of $(SCORE) does not exist ; \
- fi
@if [ $(FONT) = "" ] ; then true ; \
elif echo $(FONT) | grep -c -- '-m-.*-.*-.*$$' > /dev/null ; then \
if [ "$(XLSFONTS)" = "" -o "$(DISPLAY)" = "" ] ; then \
diff --git a/Makefile.std b/Makefile.std
index 39b8935..84fdd8e 100644
--- a/Makefile.std
+++ b/Makefile.std
@@ -435,13 +435,9 @@ KNR =
TIME =
# TIME = -DUSETIME
-# game defaults, you probably only want to alter the SCORE
+# game defaults, you probably do not want to alter these
#
-# where is the high score file?
-# SCORE = $(LOCAL)/lib/$(APP)
-SCORE = $(LIBDIR)/$(APP)
-
# The following defines are needed for some implementations and/or sites.
# It is xmkmf's job to get these right in the first place.
# If you have to declare any of these, X may not be installed correctly.
@@ -462,14 +458,10 @@ SCORE = $(LIBDIR)/$(APP)
# owner and access rights for executable & score directory
# these are set for a setuid xmris
OWNER = -o games
-INSTSCOREFLAGS = $(OWNER) -m 755
INSTMRISFLAGS = $(OWNER) $(INSTUIDFLAGS)
# normal install locations
THEBINDIR = $(BINDIR)
THEMANDIR = $(MANDIR)
-# for open access you want 777 and $(INSTPGMFLAGS),
-# (the personal score files go in users' home dirs.)
-# INSTSCOREFLAGS = -m 777
# INSTMRISFLAGS = $(INSTPGMFLAGS)
# If you're not installing in the default locations
# DESTDIR =
@@ -485,7 +477,7 @@ COFLAGS = -l
RCSFLAGS =
DEFINES = $(EXTRACCOPTIONS) -DFONT_NAME='$(FONT)' $(NDEBUG) \
- -DSCORE_DIR='"$(SCORE)"' $(TIME) $(KNR) -DSCROLLBARBUGFIX
+ $(TIME) $(KNR) -DSCROLLBARBUGFIX
LOCAL_LIBRARIES = $(XAWLIB) $(XTOOLLIB) $(XMULIB) $(XLIB) $(MATHSLIB)
DEPLIBS = $(DEPXLIB)
@@ -665,25 +657,7 @@ install:: Xmris.ad
$(INSTALL) $(INSTALLFLAGS) $(INSTAPPFLAGS) Xmris.ad $(DESTDIR)$(XAPPLOADDIR)/Xmris
Xmris.ad : Xmris-ad.src
- sed -e 's@SCORE@$(SCORE)@' -e s@FONT@$(FONT)@ < Xmris-ad.src > Xmris.ad
-
-# score directory install
-install ::
- @if [ -d $(SCORE) ]; then set +x; \
- else (set -x; $(MKDIRHIER) $(SCORE)); fi
- @#not all $(INSTALL) have a -d flag, have to do it explicitly
- @echo installing $(INSTSCOREFLAGS) $(SCORE)
- @set -- $(INSTSCOREFLAGS) ; \
- while [ $$# -ne 0 ] ; \
- do \
- case "$$1" in \
- "-o") shift ; chown $$1 $(SCORE) ; echo owner is $$1 ;; \
- "-m") shift ; chmod $$1 $(SCORE) ;; \
- "-g") shift ; chgrp $$1 $(SCORE) ; echo group is $$1 ;; \
- *) echo unknown option '$$1' ;; \
- esac ; \
- shift ; \
- done
+ sed -e s@FONT@$(FONT)@ < Xmris-ad.src > Xmris.ad
# install default gardens
install :: $(GARDENS)
@@ -1257,9 +1231,6 @@ initialize :
@if [ `ls -t Makefile Imakefile | sed '2,$$d'` = Imakefile ] ; then \
echo Warning:Makefile is older than Imakefile ; \
fi
- @if [ ! -d `echo '$(SCORE)' | sed 's=/[^/]*$$=='` ] ; then \
- echo The parent of $(SCORE) does not exist ; \
- fi
@if [ $(FONT) = "" ] ; then true ; \
elif echo $(FONT) | grep -c -- '-m-.*-.*-.*$$' > /dev/null ; then \
if [ "$(XLSFONTS)" = "" -o "$(DISPLAY)" = "" ] ; then \
diff --git a/README b/README
index f6c80b0..58dc90a 100644
--- a/README
+++ b/README
@@ -29,16 +29,6 @@ the define USETIME, this will give less accurate timing. Also
gettimeofday may or may not need a timezone argument, this is checked
by the system type in timer.c.
-Set SCORE to the name of the high score directory.
-The score file uses lockf or flock by default, this doesn't work
-on some distributed filing systems. If so,
-define USELOCKFILE, and a lock file is used to do the locking with
-open(O_CREAT | O_EXCL). The name of the lock file is xmris.lock.
-For this to work the high score directory must be writeable, which
-is not the case with lockf. Personal high score files are also put
-in this directory, if xmris can create them there, otherwise they
-will be put in the users' home directory.
-
You may need to force static linking, and not use shared libraries, or
store a library load path with the binary with the linker -R option.
The EXTRA_LOAD_FLAGS can be used for this. (This may be necessary for
diff --git a/Xmris-ad.src b/Xmris-ad.src
index 60be0ac..6368076 100644
--- a/Xmris-ad.src
+++ b/Xmris-ad.src
@@ -13,7 +13,6 @@
*Quit: q
*Iconize: i
*Keyboard: k
-*Dir: SCORE
*ReverseVideo: no
*Monochrome: no
*Gender: he
diff --git a/common.h b/common.h
index 0babbce..b146a47 100644
--- a/common.h
+++ b/common.h
@@ -280,7 +280,6 @@ typedef struct Data
{
Font font; /* font to use */
#ifndef XMRED
- String dir; /* score directory */
String expire; /* expiration */
String remove; /* removal */
String boards; /* board definitions */
diff --git a/defcom.c b/defcom.c
index 9715fe9..1c63cbc 100644
--- a/defcom.c
+++ b/defcom.c
@@ -193,7 +193,6 @@ CommandOptionDesc command_options[] =
{"-remove", 1, XtOffsetOf(DATA, remove)},
{"-nodisplay",0, XtOffsetOf(DATA, nodisplay)},
{"+display", 0, XtOffsetOf(DATA, nodisplay)},
- {"-dir", 1, XtOffsetOf(DATA, dir)},
#endif /* XMRED */
{NULL}
};
@@ -228,9 +227,6 @@ XrmOptionDescRec options[] =
XtResource resources[] =
{
#ifndef XMRED
- /* dir must be first */
- {"dir", "Dir", XtRString, sizeof(String),
- XtOffsetOf(DATA, dir), XtRString, (XtPointer)SCORE_DIR},
{"up", "Up", XtRKeySym, sizeof(KeySym),
XtOffsetOf(DATA, keysyms[0]), XtRString, (XtPointer)"Up"},
{"down", "Down", XtRKeySym, sizeof(KeySym),
@@ -371,7 +367,6 @@ HELP CONST help[] =
{"Modern sprites", "-msit", "Gender:she", ""},
#ifndef XMRED
{"Random apples", "-random", "Random:yes", ""},
- {"High score directory", "-dir", "Dir:", "<directory>"},
{"Use username in score", "-username", "UserName:yes", ""},
{"Use realname in score", "-realname", "UserName:no", ""},
#endif /* XMRED */
diff --git a/draw.c b/draw.c
index ea0f65d..fcf5401 100644
--- a/draw.c
+++ b/draw.c
@@ -1039,10 +1039,6 @@ ARGSEP char CONST *parent
if(!lib)
lib = XtResolvePathname(display.display, "app-defaults/xmris",
name, FILE_SUFFIX, NULL, NULL, 0, NULL);
- if(!lib && data.dir)
- lib = XtResolvePathname(display.display, data.dir, name,
- FILE_SUFFIX, "%T/%N:%T/%N%S:%T/gardens/%N:%T/gardens/%N%S",
- NULL, 0, NULL);
if(lib)
{
XtFree(filename);
diff --git a/makemris.c b/makemris.c
index 4bf8d20..95046d7 100644
--- a/makemris.c
+++ b/makemris.c
@@ -309,7 +309,6 @@ ARGSEP String *argv
/*{{{ some more setup*/
{
XtResource CONST *ptr;
- char *dir;
XtAppSetTypeConverter(display.context, XtRString, XtRKeySym,
convert_string2keysym, (XtConvertArgRec *)NULL, 0, XtCacheNone,
@@ -320,13 +319,10 @@ ARGSEP String *argv
(void (*)PROTOARG((XtAppContext, XrmValue *, XtPointer,
XrmValue *, Cardinal *)))NULL);
display.display = XtDisplay(display.toplevel);
- dir = data.dir;
for(ptr = resources; *(char CONST **)ptr; ptr++)
/* EMPTY */;
XtGetApplicationResources(display.toplevel, (XtPointer)&data,
resources, (Cardinal)(ptr - resources), (Arg *)NULL, 0);
- if(dir)
- data.dir = dir;
gettoplevelresources();
XtVaSetValues(display.toplevel,
XtNtitle, (XtArgVal)names[data.gender != False],
@@ -340,8 +336,6 @@ ARGSEP String *argv
}
}
/*}}}*/
- if(!data.dir)
- data.dir = (char *)resources[0].default_addr;
}
/*}}}*/
return;
diff --git a/scoring.c b/scoring.c
index ede2f07..2e93b30 100644
--- a/scoring.c
+++ b/scoring.c
@@ -17,6 +17,7 @@
#endif /* SYSV */
/*}}}*/
/*{{{ static*/
+static CONST char *score_dir = "/var/games";
static CONST char date_formats[4] = "DMY";
static char *score_file = NULL; /* high score file name */
static char *personal_file = NULL; /* personal in high score dir */
@@ -287,25 +288,22 @@ extern VOIDFUNC init_scores FUNCARGVOID
scoring.alternate = alternate;
}
/*}}}*/
- dirlen = data.dir ? strlen(data.dir) : 0;
- if(dirlen && data.dir[dirlen - 1] == '/')
- dirlen--;
/*{{{ score directory?*/
- if(dirlen)
{
size_t nlen;
+ dirlen = strlen(score_dir);
score_file = malloc(dirlen + 14);
if(score_file)
{
- strcpy(score_file, data.dir);
+ strcpy(score_file, score_dir);
strcpy(&score_file[dirlen], "/xmris.score");
}
nlen = strlen(user);
personal_file = malloc(dirlen + 8 + nlen);
if(personal_file)
{
- strcpy(personal_file, data.dir);
+ strcpy(personal_file, score_dir);
strcpy(&personal_file[dirlen], "/xmris-");
strcpy(&personal_file[dirlen + 7], user);
}
@@ -591,16 +589,15 @@ FUNCARG((insert),
/*{{{ try personal files too*/
{
/*{{{ score directory?*/
- if(data.dir)
{
size_t dirlen;
char *file;
- dirlen = strlen(data.dir);
+ dirlen = strlen(score_dir);
file = malloc(dirlen + 8 + strlen(data.remove));
if(file)
{
- strcpy(file, data.dir);
+ strcpy(file, score_dir);
strcpy(&file[dirlen], "/xmris-");
strcpy(&file[dirlen + 7], data.remove);
if(!unlink(file))
diff --git a/xmris.h b/xmris.h
index 1802e87..1e696c5 100644
--- a/xmris.h
+++ b/xmris.h
@@ -13,11 +13,6 @@
#define FUNCANIMATE(name, arg) PROTOVOID(*name(arg)) PROTOVOID(*arg);
#endif
/*}}}*/
-/*{{{ check score*/
-#ifndef SCORE_DIR
- #error No default score directory
-#endif /* SCORE_DIR */
-/*}}}*/
/*{{{ defines*/
/*{{{ board sizes*/
#define KNOCK_THROUGH /* how far we go to knock through a new cell */\
@@ -41,9 +36,6 @@
#define SCORE_SCALE 1024 /* precision of score scaling */
/*}}}*/
/*{{{ score file*/
-#ifndef SCORE_DIR
-#define SCORE_DIR NULL
-#endif /* SCORE_DIR */
#define SCORE_THRESHOLD 10000 /* minimum score for fame */
#define SCORE_ROUND 5 /* scores are rounded */
#define HIGH_SCORES (CELLS_DOWN - 2)
diff --git a/xmris.man b/xmris.man
index 3fe5028..f108e24 100644
--- a/xmris.man
+++ b/xmris.man
@@ -231,17 +231,12 @@ is still being used for the initial part of the frame delay.
.br
.ne 3
.TP
-.B \-dir \fIscore-directory\fP
-Specify a different score directory.
-.br
-.ne 4
-.TP
.PD 0
.B \-username
.TP
.B \-realname
.PD
-The name for the score file can be either the username or the real name.
+The name inside the score file can be either the username or the real name.
These options select which to use. The default is to use the real name.
If the real name is unobtainable, the username will
be used anyway. If the current score file has an entry by the other
@@ -257,10 +252,8 @@ the Mr Is subdirectory of app-defaults. These are explained below.
.ne 3
.TP
.B \-scores
-List the high scores to stdout. Does not start the game. Note that this
-will still need to open an X display, in order to read the X resources
-(which may affect the score directory). If you don't want the defaults
-read, use the +display option too.
+List the high scores to stdout. Does not start the game. An X display
+will still be opened. The +display option may be used to prevent this.
.br
.ne 4
.TP
@@ -422,11 +415,6 @@ sensitive.
.br
.ne 3
.TP
-.B Xmris.Dir: \fIscore-directory\fP
-The name of the high score directory.
-.br
-.ne 3
-.TP
.B Xmris.UserName: \fI{yes, no}\fP [no]
Selects whether the username or real name should be used for your entry
in the high score table.
@@ -851,9 +839,8 @@ following names.
.br
.ne 3
.TP
-.B .../xmris.score
-The high score file. The directory is system dependent, and may be
-changed by application resource or option.
+.B /var/games/xmris.score
+The high score file.
This file must either exist and be writable to by Mr Is, or the
directory containing it must be writable by Mr Is.
.br
@@ -888,12 +875,7 @@ See X for information about how these are searched.
.br
.ne 6
.TP
-.PD 0
.B .../app-defaults/xmris/<gardens>
-.TP
-.B <score-dir>/<gardens>
-.TP
-.B <score-dir>/gardens/<gardens>
.PD
Search path for loadable gardens. The suffix ".gdn" is appended to the
filename, if required.
--
1.7.5
0013-Drop-support-for-global-personal-file.patch:
scoring.c | 91 +++++---------------------------------------------------------
xmris.man | 15 ----------
2 files changed, 9 insertions(+), 97 deletions(-)
--- NEW FILE 0013-Drop-support-for-global-personal-file.patch ---
>From 256730c26c8369518d131d9b85a871907cf3f7bc Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Sat, 30 Apr 2011 16:09:45 +0200
Subject: [PATCH 13/20] Drop support for global personal file
Having it in $home works fine and having support for both just
needlessly complicates the code.
---
scoring.c | 91 +++++-------------------------------------------------------
xmris.man | 14 +---------
2 files changed, 9 insertions(+), 96 deletions(-)
diff --git a/scoring.c b/scoring.c
index 2e93b30..fd2cd77 100644
--- a/scoring.c
+++ b/scoring.c
@@ -20,9 +20,7 @@
static CONST char *score_dir = "/var/games";
static CONST char date_formats[4] = "DMY";
static char *score_file = NULL; /* high score file name */
-static char *personal_file = NULL; /* personal in high score dir */
static char *personal_home = NULL; /* personal in home dir */
-static int personal_make = 2;
static char date_format[4] = " ";
static char *alternate = NULL; /* alternative name */
static HIGH_SCORE *CONST tables[] =
@@ -54,8 +52,7 @@ extern VOIDFUNC check_scores FUNCARGVOID
{
retire_scores();
if((score_file && file_changed(score_file)) ||
- (!personal_make && personal_file &&
- file_changed(personal_file)))
+ (personal_home && file_changed(personal_home)))
load_check_expire_insert(0);
return;
}
@@ -290,8 +287,6 @@ extern VOIDFUNC init_scores FUNCARGVOID
/*}}}*/
/*{{{ score directory?*/
{
- size_t nlen;
-
dirlen = strlen(score_dir);
score_file = malloc(dirlen + 14);
if(score_file)
@@ -299,14 +294,6 @@ extern VOIDFUNC init_scores FUNCARGVOID
strcpy(score_file, score_dir);
strcpy(&score_file[dirlen], "/xmris.score");
}
- nlen = strlen(user);
- personal_file = malloc(dirlen + 8 + nlen);
- if(personal_file)
- {
- strcpy(personal_file, score_dir);
- strcpy(&personal_file[dirlen], "/xmris-");
- strcpy(&personal_file[dirlen + 7], user);
- }
}
/*}}}*/
/*{{{ personal file*/
@@ -421,11 +408,10 @@ FUNCARG((insert),
*/
{
FILE *score_stream;
- FILE *personal_stream;
FILE *home_stream;
unsigned do_score, do_personal;
- score_stream = personal_stream = home_stream = NULL;
+ score_stream = home_stream = NULL;
do_score = do_personal = 0;
/*{{{ score_file?*/
if(score_file)
@@ -437,37 +423,14 @@ FUNCARG((insert),
do_score = 1;
}
/*}}}*/
- /*{{{ personal_file?*/
- if(personal_file)
- {
- personal_stream = get_lock(personal_file, personal_make);
- if(personal_stream)
- {
- personal_make = 0;
- if(personal_home && !unlink(personal_home))
- fprintf(stderr, "Two personal score files, '%s' removed\n",
- personal_home);
- personal_home = NULL;
- do_personal = merge_personal(personal_stream);
- }
- }
- /*}}}*/
/*{{{ personal_home?*/
if(personal_home)
{
home_stream = get_lock(personal_home, 2);
if(home_stream)
- {
- merge_personal(home_stream);
- if(!personal_file)
- {
- personal_file = personal_home;
- personal_home = NULL;
- personal_make = 0;
- }
- else
- do_personal = 1;
- }
+ do_personal = merge_personal(home_stream);
+ else
+ do_personal = 1;
}
/*}}}*/
/*{{{ check alternate*/
@@ -588,27 +551,6 @@ FUNCARG((insert),
do_score |= found;
/*{{{ try personal files too*/
{
- /*{{{ score directory?*/
- {
- size_t dirlen;
- char *file;
-
- dirlen = strlen(score_dir);
- file = malloc(dirlen + 8 + strlen(data.remove));
- if(file)
- {
- strcpy(file, score_dir);
- strcpy(&file[dirlen], "/xmris-");
- strcpy(&file[dirlen + 7], data.remove);
- if(!unlink(file))
- {
- personal = 1;
- found = 1;
- }
- free(file);
- }
- }
- /*}}}*/
/*{{{ home directory?*/
{
if(home)
@@ -1003,39 +945,22 @@ FUNCARG((insert),
/*{{{ write personal?*/
if(do_personal)
{
- if(!personal_stream && score_stream && personal_file)
- personal_stream = get_lock(personal_file, 3);
- if(personal_stream)
- {
- write_personal(personal_stream);
- if(personal_home)
- unlink(personal_home);
- personal_home = NULL;
- }
- else
- {
if(!home_stream)
home_stream = get_lock(personal_home, 1);
if(home_stream)
write_personal(home_stream);
else
personal_home = NULL;
- personal_file = personal_home;
- personal_home = NULL;
- }
- personal_make = 0;
}
/*}}}*/
- if(personal_stream)
- get_unlock(personal_stream);
if(home_stream)
get_unlock(home_stream);
if(score_stream)
get_unlock(score_stream);
if(do_score && score_file)
file_changed(score_file);
- if(do_personal && personal_file)
- file_changed(personal_file);
+ if(do_personal && personal_home)
+ file_changed(personal_home);
return;
}
/*}}}*/
@@ -1103,7 +1028,7 @@ FUNCARG((stream),
if(failed)
{
fprintf(stderr, "%s:Your personal score file '%s' has been corrupted.\n",
- myname, personal_file);
+ myname, personal_home);
scoring.personal[0].score = 0;
}
return failed;
diff --git a/xmris.man b/xmris.man
index f108e24..ae881c0 100644
--- a/xmris.man
+++ b/xmris.man
@@ -846,21 +846,9 @@ directory containing it must be writable by Mr Is.
.br
.ne 3
.TP
-.PD 0
-.B .../xmris-<name>
-.TP
.B ~/.xmris.score
.PD
-One of these files is used to store the personal best scores.
-Mr Is first looks for the personal score file in the score directory and
-then in the home directory. If a personal
-score file cannot be found, Mr Is attempts to create one.
-If the file is found in the user's home directory, Mr Is attempts
-to move it to the score directory. Mr Is
-will attempt to create the personal files in the score directory. If this
-cannot be done, the personal score file is placed in the home directory. In
-order to create the personal score file in the score directory, Mr Is will
-have to have the correct access rights.
+This file is used to store the personal best scores.
.br
.ne 5
.TP
--
1.7.5
0014-Some-renames.patch:
scoring.c | 47 +++++++++++++++++++++++------------------------
1 file changed, 23 insertions(+), 24 deletions(-)
--- NEW FILE 0014-Some-renames.patch ---
>From 5997920c77b25c8ed4a79f44da13436ad05412e5 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Sat, 30 Apr 2011 16:12:48 +0200
Subject: [PATCH 14/20] Some renames
Things make more sense after the previous commit with some vars renamed:
s/personal_home/personal_file/
s/home_stream/personal_stream/
---
scoring.c | 46 +++++++++++++++++++++++-----------------------
1 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/scoring.c b/scoring.c
index fd2cd77..72f08d6 100644
--- a/scoring.c
+++ b/scoring.c
@@ -20,7 +20,7 @@
static CONST char *score_dir = "/var/games";
static CONST char date_formats[4] = "DMY";
static char *score_file = NULL; /* high score file name */
-static char *personal_home = NULL; /* personal in home dir */
+static char *personal_file = NULL; /* personal in home dir */
static char date_format[4] = " ";
static char *alternate = NULL; /* alternative name */
static HIGH_SCORE *CONST tables[] =
@@ -52,7 +52,7 @@ extern VOIDFUNC check_scores FUNCARGVOID
{
retire_scores();
if((score_file && file_changed(score_file)) ||
- (personal_home && file_changed(personal_home)))
+ (personal_file && file_changed(personal_file)))
load_check_expire_insert(0);
return;
}
@@ -305,11 +305,11 @@ extern VOIDFUNC init_scores FUNCARGVOID
size_t length;
length = strlen(home);
- personal_home = malloc(length + 15);
- if(personal_home)
+ personal_file = malloc(length + 15);
+ if(personal_file)
{
- strcpy(personal_home, home);
- strcpy(&personal_home[length], "/.xmris.score");
+ strcpy(personal_file, home);
+ strcpy(&personal_file[length], "/.xmris.score");
}
}
}
@@ -408,10 +408,10 @@ FUNCARG((insert),
*/
{
FILE *score_stream;
- FILE *home_stream;
+ FILE *personal_stream;
unsigned do_score, do_personal;
- score_stream = home_stream = NULL;
+ score_stream = personal_stream = NULL;
do_score = do_personal = 0;
/*{{{ score_file?*/
if(score_file)
@@ -423,12 +423,12 @@ FUNCARG((insert),
do_score = 1;
}
/*}}}*/
- /*{{{ personal_home?*/
- if(personal_home)
+ /*{{{ personal_file?*/
+ if(personal_file)
{
- home_stream = get_lock(personal_home, 2);
- if(home_stream)
- do_personal = merge_personal(home_stream);
+ personal_stream = get_lock(personal_file, 2);
+ if(personal_stream)
+ do_personal = merge_personal(personal_stream);
else
do_personal = 1;
}
@@ -945,22 +945,22 @@ FUNCARG((insert),
/*{{{ write personal?*/
if(do_personal)
{
- if(!home_stream)
- home_stream = get_lock(personal_home, 1);
- if(home_stream)
- write_personal(home_stream);
+ if(!personal_stream)
+ personal_stream = get_lock(personal_file, 1);
+ if(personal_stream)
+ write_personal(personal_stream);
else
- personal_home = NULL;
+ personal_file = NULL;
}
/*}}}*/
- if(home_stream)
- get_unlock(home_stream);
+ if(personal_stream)
+ get_unlock(personal_stream);
if(score_stream)
get_unlock(score_stream);
if(do_score && score_file)
file_changed(score_file);
- if(do_personal && personal_home)
- file_changed(personal_home);
+ if(do_personal && personal_file)
+ file_changed(personal_file);
return;
}
/*}}}*/
@@ -1028,7 +1028,7 @@ FUNCARG((stream),
if(failed)
{
fprintf(stderr, "%s:Your personal score file '%s' has been corrupted.\n",
- myname, personal_home);
+ myname, personal_file);
scoring.personal[0].score = 0;
}
return failed;
--
1.7.5
0015-Open-score-files-only-once-and-keep-them-open-till-t.patch:
scoring.c | 151 ++++++++++++++++++++++++++++++--------------------------------
xmris.c | 1
xmris.h | 2
3 files changed, 76 insertions(+), 78 deletions(-)
--- NEW FILE 0015-Open-score-files-only-once-and-keep-them-open-till-t.patch ---
>From 1105d6f3df03ffe6f3bd26fc37f8daf092f920e5 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Sun, 1 May 2011 10:59:39 +0200
Subject: [PATCH 15/20] Open score files only once and keep them open till the
program exits
---
scoring.c | 151 ++++++++++++++++++++++++++++++-------------------------------
xmris.c | 1 +
xmris.h | 1 +
3 files changed, 76 insertions(+), 77 deletions(-)
diff --git a/scoring.c b/scoring.c
index 72f08d6..381057b 100644
--- a/scoring.c
+++ b/scoring.c
@@ -17,10 +17,11 @@
#endif /* SYSV */
/*}}}*/
/*{{{ static*/
-static CONST char *score_dir = "/var/games";
static CONST char date_formats[4] = "DMY";
-static char *score_file = NULL; /* high score file name */
+static char *score_file = "/var/games/xmris.score"; /* score file name */
static char *personal_file = NULL; /* personal in home dir */
+static FILE *score_stream = NULL;
+static FILE *personal_stream = NULL;
static char date_format[4] = " ";
static char *alternate = NULL; /* alternative name */
static HIGH_SCORE *CONST tables[] =
@@ -29,7 +30,7 @@ static HIGH_SCORE *CONST tables[] =
/*{{{ prototypes*/
static unsigned expire PROTOARG((time_t, time_t));
static unsigned file_changed PROTOARG((char CONST *));
-static FILE *get_lock PROTOARG((char CONST *, unsigned));
+static unsigned get_lock PROTOARG((FILE *));
static VOIDFUNC get_unlock PROTOARG((FILE *));
static unsigned insert_personal PROTOARG((HIGH_SCORE CONST *));
static unsigned insert_score
@@ -106,33 +107,29 @@ FUNCARG((name),
return changed;
}
/*}}}*/
-/*{{{ void get_lock(name, flag)*/
-static FILE *get_lock
-FUNCARG((name, flag),
- char CONST *name
-ARGSEP unsigned flag
+/*{{{ unsigned get_lock(stream)*/
+static unsigned get_lock
+FUNCARG((stream),
+ FILE *stream
)
/*
- * open and locks a high score file
- * flag & 1 == 0 -> "r+"
- * flag & 1 != 0 -> "w+"
- * flag & 2 inhibit error message
+ * lock the high score file
*/
{
- FILE *stream;
-
- stream = fopen(name, flag & 1 ? "w+" : "r+");
- if(!stream && !(flag & 2))
- perror(name);
- if(stream)
/*{{{ get lock on the file*/
- while(lock_file(stream))
+ while(1)
{
- if(errno == EINTR)
- continue;
+ int res = lock_file(stream);
+ if(res)
+ {
+ if(errno == EINTR)
+ continue;
+ perror("Error locking score file");
+ }
+
+ return res == 0;
}
/*}}}*/
- return stream;
}
/*}}}*/
/*{{{ void get_unlock(stream)*/
@@ -141,14 +138,10 @@ FUNCARG((stream),
FILE *stream
)
/*
- * unlock and close the high score file
+ * unlock the high score file
*/
{
- fflush(stream);
- rewind(stream);
unlock_file(stream);
- fclose(stream);
- return;
}
/*}}}*/
/*{{{ void high_score(score, screen, msec)*/
@@ -186,7 +179,6 @@ extern VOIDFUNC init_scores FUNCARGVOID
char CONST *user;
char CONST *home;
char *reallife;
- size_t dirlen;
user = NULL;
home = NULL;
@@ -287,13 +279,12 @@ extern VOIDFUNC init_scores FUNCARGVOID
/*}}}*/
/*{{{ score directory?*/
{
- dirlen = strlen(score_dir);
- score_file = malloc(dirlen + 14);
- if(score_file)
- {
- strcpy(score_file, score_dir);
- strcpy(&score_file[dirlen], "/xmris.score");
- }
+ score_stream = fopen(score_file, "r+");
+ /* If we cannot open it, try creating it */
+ if(!score_stream)
+ score_stream = fopen(score_file, "w+");
+ if (!score_stream)
+ score_file = NULL;
}
/*}}}*/
/*{{{ personal file*/
@@ -310,6 +301,15 @@ extern VOIDFUNC init_scores FUNCARGVOID
{
strcpy(personal_file, home);
strcpy(&personal_file[length], "/.xmris.score");
+
+ personal_stream = fopen(personal_file, "r+");
+ if(!personal_stream)
+ personal_stream = fopen(personal_file, "w+");
+ if(!personal_stream)
+ {
+ free(personal_file);
+ personal_file = NULL;
+ }
}
}
}
@@ -320,6 +320,24 @@ extern VOIDFUNC init_scores FUNCARGVOID
return;
}
/*}}}*/
+/*{{{ void init_scores()*/
+extern VOIDFUNC cleanup_scores FUNCARGVOID
+/*
+ * Close open score files
+ */
+{
+ if(score_stream)
+ {
+ fclose(score_stream);
+ score_stream = NULL;
+ }
+ if(personal_stream)
+ {
+ fclose(personal_stream);
+ personal_stream = NULL;
+ }
+}
+/*}}}*/
/*{{{ unsigned insert_personal(sptr)*/
static unsigned insert_personal
FUNCARG((sptr),
@@ -407,32 +425,23 @@ FUNCARG((insert),
* write the files back
*/
{
- FILE *score_stream;
- FILE *personal_stream;
- unsigned do_score, do_personal;
-
- score_stream = personal_stream = NULL;
- do_score = do_personal = 0;
- /*{{{ score_file?*/
- if(score_file)
+ unsigned do_score = 0, do_personal = 0;
+ unsigned score_lock = 0, personal_lock = 0;
+
+ if(score_stream)
{
- score_stream = get_lock(score_file, 2);
- if(score_stream)
+ score_lock = get_lock(score_stream);
+ if(score_lock)
do_score = merge_scores(score_stream);
- else
- do_score = 1;
}
- /*}}}*/
- /*{{{ personal_file?*/
- if(personal_file)
+
+ if(personal_stream)
{
- personal_stream = get_lock(personal_file, 2);
- if(personal_stream)
+ personal_lock = get_lock(personal_stream);
+ if(personal_lock)
do_personal = merge_personal(personal_stream);
- else
- do_personal = 1;
}
- /*}}}*/
+
/*{{{ check alternate*/
if(alternate)
{
@@ -930,37 +939,23 @@ FUNCARG((insert),
}
/*}}}*/
/*{{{ write_score?*/
- if(do_score)
+ if(do_score && score_lock)
{
- if(!score_stream && score_file)
- {
- score_stream = get_lock(score_file, 5);
- if(!score_stream)
- score_file = NULL;
- }
- if(score_stream)
- write_scores(score_stream);
+ write_scores(score_stream);
+ file_changed(score_file);
}
/*}}}*/
/*{{{ write personal?*/
- if(do_personal)
+ if(do_personal && personal_lock)
{
- if(!personal_stream)
- personal_stream = get_lock(personal_file, 1);
- if(personal_stream)
- write_personal(personal_stream);
- else
- personal_file = NULL;
+ write_personal(personal_stream);
+ file_changed(personal_file);
}
/*}}}*/
- if(personal_stream)
+ if(personal_lock)
get_unlock(personal_stream);
- if(score_stream)
+ if(score_lock)
get_unlock(score_stream);
- if(do_score && score_file)
- file_changed(score_file);
- if(do_personal && personal_file)
- file_changed(personal_file);
return;
}
/*}}}*/
@@ -1218,6 +1213,7 @@ FUNCARG((stream),
check = 0;
}
fprintf(stream, "+%lu\n", check);
+ fflush(stream);
return;
}
/*}}}*/
@@ -1245,6 +1241,7 @@ FUNCARG((stream),
check = 0;
}
fprintf(stream, "+%lu %s\n", check, date_format);
+ fflush(stream);
return;
}
/*}}}*/
diff --git a/xmris.c b/xmris.c
index b1a0404..f10e3f7 100644
--- a/xmris.c
+++ b/xmris.c
@@ -1348,6 +1348,7 @@ ARGSEP char CONST **argv
assert(monster.normals < 20);
}
timer_close();
+ cleanup_scores();
return 0;
}
/*}}}*/
diff --git a/xmris.h b/xmris.h
index 1e696c5..34969df 100644
--- a/xmris.h
+++ b/xmris.h
@@ -536,6 +536,7 @@ extern unsigned move_player PROTOARG((VOIDARG));
extern VOIDFUNC check_scores PROTOARG((VOIDARG));
extern VOIDFUNC high_score PROTOARG((unsigned long, unsigned, unsigned long));
extern VOIDFUNC init_scores PROTOARG((VOIDARG));
+extern VOIDFUNC cleanup_scores PROTOARG((VOIDARG));
/*}}}*/
/*{{{ timer*/
extern VOIDFUNC timer_close PROTOARG((VOIDARG));
--
1.7.5
0016-Open-the-global-score-file-asap-and-drop-special-rig.patch:
Imakefile | 4 ++--
scoring.c | 42 ++++++++++++++++++++++++++++++++----------
xmris.c | 2 ++
xmris.h | 2 +-
4 files changed, 37 insertions(+), 13 deletions(-)
--- NEW FILE 0016-Open-the-global-score-file-asap-and-drop-special-rig.patch ---
>From 74743124c7cd2ed7ff5e33e436a73d3f0f70ce6a Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Sun, 1 May 2011 11:12:09 +0200
Subject: [PATCH 16/20] Open the global score file asap, and drop special
rights directly after
This completes making the highscore code truely safe for sgid usage.
---
Imakefile | 4 ++--
scoring.c | 42 ++++++++++++++++++++++++++++++++----------
xmris.c | 2 ++
xmris.h | 1 +
4 files changed, 37 insertions(+), 12 deletions(-)
diff --git a/Imakefile b/Imakefile
index dcf93c8..09931d8 100644
--- a/Imakefile
+++ b/Imakefile
@@ -85,9 +85,9 @@ XCOMM install parameters
XCOMM
XCOMM owner and access rights for executable & score directory
XCOMM these are set for a setuid xmris
-XCOMM OWNER = -o games
+XCOMM OWNER = -g games
OWNER =
-INSTMRISFLAGS = $(OWNER) $(INSTUIDFLAGS)
+INSTMRISFLAGS = $(OWNER) $(INSTGIDFLAGS)
XCOMM normal install locations
THEBINDIR = $(BINDIR)
THEMANDIR = $(MANDIR)
diff --git a/scoring.c b/scoring.c
index 381057b..45c14d8 100644
--- a/scoring.c
+++ b/scoring.c
@@ -1,4 +1,5 @@
/* Copyright (C) 1993, 1992 Nathan Sidwell */
+#define _GNU_SOURCE /* for setresuid / setresgid */
#include "xmris.h"
/*{{{ other includes*/
#include <pwd.h>
@@ -169,6 +170,37 @@ ARGSEP unsigned long msec
return;
}
/*}}}*/
+/*{{{ void init_scores_early()*/
+extern VOIDFUNC init_scores_early FUNCARGVOID
+/*
+ * To be called asap from main, open the global highscore file and drop
+ * sgid rights
+ */
+{
+ /* Figure out who we really are. */
+ gid_t realgid = getgid();
+ uid_t realuid = getuid();
+
+ score_stream = fopen(score_file, "r+");
+ /* If we cannot open it, try creating it */
+ if(!score_stream)
+ score_stream = fopen(score_file, "w+");
+ if(!score_stream)
+ score_file = NULL;
+
+ /* This is where we drop our setuid/setgid privileges. */
+ if(setresgid(-1, realgid, realgid) != 0)
+ {
+ perror("Could not drop setgid privileges. Aborting.");
+ exit(1);
+ }
+ if(setresuid(-1, realuid, realuid) != 0)
+ {
+ perror("Could not drop setuid privileges. Aborting.");
+ exit(1);
+ }
+}
+/*}}}*/
/*{{{ void init_scores()*/
extern VOIDFUNC init_scores FUNCARGVOID
/*
@@ -277,16 +309,6 @@ extern VOIDFUNC init_scores FUNCARGVOID
scoring.alternate = alternate;
}
/*}}}*/
- /*{{{ score directory?*/
- {
- score_stream = fopen(score_file, "r+");
- /* If we cannot open it, try creating it */
- if(!score_stream)
- score_stream = fopen(score_file, "w+");
- if (!score_stream)
- score_file = NULL;
- }
- /*}}}*/
/*{{{ personal file*/
{
if(!home)
diff --git a/xmris.c b/xmris.c
index f10e3f7..a38139d 100644
--- a/xmris.c
+++ b/xmris.c
@@ -1259,6 +1259,8 @@ ARGSEP char CONST **argv
PROTOANIMATE((*animate));
Atom wm_delete_window;
+ init_scores_early();
+
myname = *argv ? *argv : "Xmris";
open_toolkit(argc, (String *)argv);
init_scores();
diff --git a/xmris.h b/xmris.h
index 34969df..99af882 100644
--- a/xmris.h
+++ b/xmris.h
@@ -535,6 +535,7 @@ extern unsigned move_player PROTOARG((VOIDARG));
/*{{{ scoring*/
extern VOIDFUNC check_scores PROTOARG((VOIDARG));
extern VOIDFUNC high_score PROTOARG((unsigned long, unsigned, unsigned long));
+extern VOIDFUNC init_scores_early PROTOARG((VOIDARG));
extern VOIDFUNC init_scores PROTOARG((VOIDARG));
extern VOIDFUNC cleanup_scores PROTOARG((VOIDARG));
/*}}}*/
--
1.7.5
0017-Set-class-to-Xmsit-Xmris-depending-on-how-we-re-laun.patch:
Imakefile | 7 ++++++-
makemris.c | 4 ++--
2 files changed, 8 insertions(+), 3 deletions(-)
--- NEW FILE 0017-Set-class-to-Xmsit-Xmris-depending-on-how-we-re-laun.patch ---
>From 07e599150a81a85f327ad8b84102c359da442ed8 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Mon, 2 May 2011 11:58:04 +0200
Subject: [PATCH 17/20] Set class to Xmsit / Xmris depending on how we're
launched
And also create a separate Xmsit.ad with gender: she so that launching as
xmsit actually gives us msit.
---
Imakefile | 7 ++++++-
makemris.c | 3 ++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Imakefile b/Imakefile
index 09931d8..31c8550 100644
--- a/Imakefile
+++ b/Imakefile
@@ -209,7 +209,7 @@ all :: initialize
all :: xmris xmred
@#keep gnumake happy
-all :: README.xmris README.xmred Xmris.ad
+all :: README.xmris README.xmred Xmris.ad Xmsit.ad
@#keep gnumake happy
XCOMM rules to make sure the initialize thing is done
@@ -251,10 +251,14 @@ InstallManPage(xmred,$(THEMANDIR))
XCOMM application resource files
InstallAppDefaults(Xmris)
+InstallAppDefaults(Xmsit)
Xmris.ad : Xmris-ad.src
sed -e s@FONT@$(FONT)@ < Xmris-ad.src > Xmris.ad
+Xmsit.ad : Xmris.ad
+ sed -e "s@Gender:\t\the@Gender:\t\tshe@" < Xmris.ad > Xmsit.ad
+
#ifdef InstallDefaultGardens
XCOMM install default gardens
install :: $(GARDENS)
@@ -273,6 +277,7 @@ NormalProgramTarget(scram,$(SCRAMOBJS),,,)
clean ::
$(RM) $(MRISOBJS)
$(RM) Xmris.ad
+ $(RM) Xmsit.ad
$(RM) $(MREDOBJS)
$(RM) $(WIDGETOBJS)
$(RM) $(SCRAMOBJS)
diff --git a/makemris.c b/makemris.c
index 95046d7..6b129c1 100644
--- a/makemris.c
+++ b/makemris.c
@@ -274,13 +274,14 @@ ARGSEP String *argv
if(data.nodisplay == False)
{
XrmOptionDescRec CONST *ptr;
+ const char *myclass = default_gender ? "Xmsit" : "Xmris";
/* as options is an extern of unknown size, I can't use
* XtNumber() to get its size, so I've done it this way
*/
for(ptr = options; *(char CONST **)ptr; ptr++)
/* EMPTY */;
- display.toplevel = XtAppInitialize(&display.context, "Xmris",
+ display.toplevel = XtAppInitialize(&display.context, myclass,
options, (Cardinal)(ptr - options),
&argc, (String *)argv,
(String *)NULL, toplevel_args, XtNumber(toplevel_args));
--
1.7.5
0018-Install-manpages-into-section-6-rather-then-1.patch:
Imakefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- NEW FILE 0018-Install-manpages-into-section-6-rather-then-1.patch ---
>From ce1204bfff0c925002033206659c755ab589adb4 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Mon, 2 May 2011 12:00:32 +0200
Subject: [PATCH 18/20] Install manpages into section 6 rather then 1
---
Imakefile | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Imakefile b/Imakefile
index 31c8550..b999fda 100644
--- a/Imakefile
+++ b/Imakefile
@@ -90,7 +90,8 @@ OWNER =
INSTMRISFLAGS = $(OWNER) $(INSTGIDFLAGS)
XCOMM normal install locations
THEBINDIR = $(BINDIR)
-THEMANDIR = $(MANDIR)
+THEMANDIR = $(MANSOURCEPATH)6
+MANSUFFIX = 6
XCOMM INSTMRISFLAGS = $(INSTPGMFLAGS)
XCOMM If you're not installing in the default locations
XCOMM DESTDIR =
--
1.7.5
0019-Add-.desktop-files.patch:
xmred.desktop | 9 +++++++++
xmris.desktop | 9 +++++++++
xmsit.desktop | 10 +++++++++-
3 files changed, 27 insertions(+), 1 deletion(-)
--- NEW FILE 0019-Add-.desktop-files.patch ---
>From e9445fb7ea16fdbcfe7577dfbad3544c90670fe8 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede(a)redhat.com>
Date: Sun, 1 May 2011 17:14:50 +0200
Subject: [PATCH 19/20] Add .desktop files
---
xmred.desktop | 9 +++++++++
xmris.desktop | 9 +++++++++
xmsit.desktop | 9 +++++++++
3 files changed, 27 insertions(+), 0 deletions(-)
create mode 100644 xmred.desktop
create mode 100644 xmris.desktop
create mode 100644 xmsit.desktop
diff --git a/xmred.desktop b/xmred.desktop
new file mode 100644
index 0000000..e60a49f
--- /dev/null
+++ b/xmred.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=X Mr Ed
+Comment=Level Editor for X Mr Is
+Exec=xmred
+Icon=xmris
+Terminal=false
+StartupNotify=false
+Type=Application
+Categories=Game;ArcadeGame;
diff --git a/xmris.desktop b/xmris.desktop
new file mode 100644
index 0000000..6cd97f2
--- /dev/null
+++ b/xmris.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=X Mr Is
+Comment=Maze digging and cherry eating game
+Exec=xmris
+Icon=xmris
+Terminal=false
+StartupNotify=false
+Type=Application
+Categories=Game;ArcadeGame;
diff --git a/xmsit.desktop b/xmsit.desktop
new file mode 100644
index 0000000..e14bdef
--- /dev/null
+++ b/xmsit.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=X Ms It
+Comment=Maze digging and cherry eating game
+Exec=xmsit
+Icon=xmsit
+Terminal=false
+StartupNotify=false
+Type=Application
+Categories=Game;ArcadeGame;
--
1.7.5
--- NEW FILE xmris.spec ---
Name: xmris
Version: 4.0.5
Release: 2%{?dist}
Summary: Maze digging and cherry eating game
Group: Amusements/Games
License: GPL+
URL: http://sourceforge.net/projects/xmris/
Source0: http://downloads.sourceforge.net/xmris/xmris.%{version}.tar.gz
# These were created from screenshots from the game
Source1: xmris.png
Source2: xmsit.png
# Various fixes
Patch1: 0001-Fix-xm-exiting-with-a-BadFont-error.patch
Patch2: 0002-Fix-timer-signal-handling-under-Linux.patch
Patch3: 0003-Adjust-Imakefile-for-modern-systems.patch
Patch4: 0004-Catch-the-window-being-deleted.patch
Patch5: 0005-Fix-compiling-of-flock-code-under-Linux.patch
Patch6: 0006-Fix-key-presses-getting-lost.patch
Patch7: 0007-Change-key-binding-defaults-to-something-sane.patch
Patch8: 0008-Fix-compiler-warnings.patch
# Patches for safe global highscore handling
Patch9: 0009-Remove-TRANSPUTER-stuff.patch
Patch10: 0010-Remove-USELOCKFILE-stuff.patch
Patch11: 0011-Remove-seteuid-stuff.patch
Patch12: 0012-Drop-dir-option.patch
Patch13: 0013-Drop-support-for-global-personal-file.patch
Patch14: 0014-Some-renames.patch
Patch15: 0015-Open-score-files-only-once-and-keep-them-open-till-t.patch
Patch16: 0016-Open-the-global-score-file-asap-and-drop-special-rig.patch
# Misc patches
Patch17: 0017-Set-class-to-Xmsit-Xmris-depending-on-how-we-re-laun.patch
Patch18: 0018-Install-manpages-into-section-6-rather-then-1.patch
Patch19: 0019-Add-.desktop-files.patch
BuildRequires: libXt-devel libXaw-devel groff imake desktop-file-utils
Requires: hicolor-icon-theme
Requires: xorg-x11-fonts-ISO8859-1-75dpi
Requires: xorg-x11-fonts-ISO8859-1-100dpi
%description
You control a gnome, who can walk around a garden, along paths already
marked, or create new paths wherever you wish. You also have a ball,
which can be thrown in the direction you're facing, towards the gnome's
feet. Points are scored for collecting cherries (if you collect eight
cherries without stopping or pushing an apple, you get a bonus),
killing monsters (by squashing them, or throwing the ball at them), and
collecting the prize left when all the monsters have come out of their
den.
%package editor
Summary: Level editor for %{name}
Requires: %{name} = %{version}-%{release}
%description editor
A level editor for %{name}.
%prep
%setup -q -n %{name}.%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%build
xmkmf
make %{?_smp_mflags} CDEBUGFLAGS="$RPM_OPT_FLAGS"
%install
make install install.man DESTDIR=$RPM_BUILD_ROOT
rm $RPM_BUILD_ROOT/usr/lib/X11/app-defaults
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/games
touch $RPM_BUILD_ROOT%{_localstatedir}/games/%{name}.score
mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/128x128/apps
install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/128x128/apps
install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/128x128/apps
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install --dir $RPM_BUILD_ROOT%{_datadir}/applications xm*.desktop
%post
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
%postun
if [ $1 -eq 0 ] ; then
touch --no-create %{_datadir}/icons/hicolor &>/dev/null
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi
%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%files
%defattr(-,root,root,-)
%doc CHANGES* COPYING-2.0 COPYRIGHT README.xmris
%attr(2755,root,games) %{_bindir}/%{name}
%{_bindir}/xmsit
%{_datadir}/%{name}
%{_datadir}/X11/app-defaults/Xm*
%{_datadir}/applications/xmris.desktop
%{_datadir}/applications/xmsit.desktop
%{_datadir}/icons/hicolor/128x128/apps/xm*.png
%{_mandir}/man6/xmris.6*
%{_mandir}/man6/xmsit.6*
%verify(not md5 size mtime) %config(noreplace) %attr(0664,root,games) %{_localstatedir}/games/%{name}.score
%files editor
%defattr(-,root,root,-)
%doc README.xmred
%{_bindir}/xmred
%{_datadir}/applications/xmred.desktop
%{_mandir}/man6/xmred.6*
%changelog
* Sat May 21 2011 Hans de Goede <j.w.r.degoede(a)gmail.com> 4.0.5-2
- Add missing BuildRequires: libXaw-devel groff
- Change font requires to: xorg-x11-fonts-ISO8859-1-75dpi + 100dpi
* Tue May 3 2011 Hans de Goede <j.w.r.degoede(a)gmail.com> 4.0.5-1
- Initial rpmfusion package
Index: .cvsignore
===================================================================
RCS file: /cvs/free/rpms/xmris/F-15/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore 7 Jun 2011 15:38:59 -0000 1.1
+++ .cvsignore 23 Jun 2011 20:06:53 -0000 1.2
@@ -0,0 +1 @@
+xmris.4.0.5.tar.gz
Index: sources
===================================================================
RCS file: /cvs/free/rpms/xmris/F-15/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources 7 Jun 2011 15:38:59 -0000 1.1
+++ sources 23 Jun 2011 20:06:53 -0000 1.2
@@ -0,0 +1 @@
+108beb6df3cda34f6797605e975345a8 xmris.4.0.5.tar.gz
13 years, 5 months