This commit is contained in:
jasoni 1998-12-18 08:13:40 +00:00
parent 6984d0a3f8
commit 4bb08a3659
3 changed files with 202 additions and 20 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.1.1.1 1998/12/04 00:29:20 jasoni Exp $
# $OpenBSD: Makefile,v 1.2 1998/12/18 08:13:40 jasoni Exp $
#
DISTNAME= WindowMaker-0.20.3
@ -20,10 +20,6 @@ CONFIGURE_ENV= INSTALL="/usr/bin/install -c"
CONFIGURE_ARGS= --with-gfx-incs=-I/usr/local/include \
--with-gfx-libs=-L/usr/local/lib
post-configure:
@cd ${WRKSRC}/libPropList && \
INSTALL="/usr/bin/install -c" ./configure
post-install:
@${INSTALL_DATA} ${WRKDIR}/WindowMaker-data/pixmaps/* \
${PREFIX}/share/WindowMaker/Pixmaps

View File

@ -1,20 +1,131 @@
--- libPropList/filehandling.c.orig Thu Dec 3 17:13:17 1998
+++ libPropList/filehandling.c Thu Dec 3 17:23:01 1998
@@ -361,9 +361,15 @@
--- libPropList/filehandling.c.orig Fri Dec 18 01:58:03 1998
+++ libPropList/filehandling.c Fri Dec 18 01:58:16 1998
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <dirent.h>
#define pl_scan_string(c) yy_scan_string(c)
#define plparse() yyparse()
@@ -350,45 +351,80 @@
char tmp_fileName[255];
char tmp_realFileName[255];
char dirname[255];
+ char dirbase[50]={"/tmp"};
+ char mkstmpname[20]={"/tmp/wmaker.XXXXXX"};
char *tmp_dirname, *tmp2_dirname;
char *basename, *tmp_basename;
FILE *theFile;
int c;
char *desc = NULL;
-
+ int i,temp_safe;
+ DIR *diro;
+ struct dirent *dire;
+ struct stat safe_stat;
+
theRealFileName = PLGetString(PLGetFilename(pl));
if(!theRealFileName) return NO;
if (atomically)
{
+ int tmpfd;
+ char tmpfilename[] = "/var/tmp/tmp.XXXXXXXXXX";
+ tmpfd = mkstemp(tmpfilename);
+ strcpy(theFileName, tmpfilename);
+ /*
theFileName = tmpnam(NULL);
- theFileName = tmpnam(NULL);
- strcpy(tmp_fileName, theFileName);
+#ifdef HAVE_MKSTEMP /* THIS IS THE MKSTEMP STUFF. FOR OPENBSD, ETC. */
+ /* im an idiot. this made wmaker crash. */
+ temp_safe = mkstemp(mkstmpname);
+ if((fstat(temp_safe,&safe_stat))!=0)
+ goto failure;
+ desc=PLGetDescriptionIndent(pl,0);
+ theFile=fdopen(temp_safe,"r+");
+ c=fwrite(desc,sizeof(char),strlen(desc),theFile);
+ if(c<strlen(desc))
+ goto failure;
+ fwrite("\n",sizeof(char),strlen("\n"),theFile);
+ diro=opendir(dirbase);
+ dire=readdir(diro);
+ while(safe_stat.st_ino!=dire->d_ino)
+ dire=readdir(diro);
+ fclose(theFile);
+ strncpy(tmp_fileName,dirbase,4);
+ tmp_fileName[5]='\0';
+ strncat(tmp_fileName,"/",1);
+ strncat(tmp_fileName,dire->d_name,15); /* should normally be under 15 */
+ c=rename(tmp_fileName,theRealFileName);
+ closedir(diro);
+ if(c!=0)
+ goto failure;
+ else
+ goto success;
- if((tmp_basename=strtok(tmp_fileName, "/")))
- do
- basename=tmp_basename;
- while((tmp_basename=strtok(NULL, "/")));
- else
- basename=(char *)theFileName;
-
- strcpy(tmp_realFileName, theRealFileName);
- dirname[0]='\0';
-
+ */
+ strcpy(tmp_fileName, theFileName);
+ close(tmpfd);
if((tmp_basename=strtok(tmp_fileName, "/")))
do
basename=tmp_basename;
- if((tmp_dirname=strtok(tmp_realFileName, "/")))
- {
- if(theRealFileName[0]=='/')
- strcat(dirname, "/");
- tmp2_dirname = strtok(NULL, "/");
- while((tmp2_dirname))
- {
- strcat(dirname, tmp_dirname);
- strcat(dirname, "/");
- tmp_dirname = tmp2_dirname;
- tmp2_dirname = strtok(NULL, "/");
- }
- }
-
- theFileName = strcat(dirname, basename);
+#else /* the old code for the tmp file */
+
+ theFileName = tmpnam(NULL);
+ strcpy(tmp_fileName, theFileName);
+
+ if((tmp_basename=strtok(tmp_fileName, "/")))
+ do
+ basename=tmp_basename;
+ while((tmp_basename=strtok(NULL, "/")));
+ else
+ basename=(char *)theFileName;
+
+ strcpy(tmp_realFileName, theRealFileName);
+ dirname[0]='\0';
+
+ if((tmp_dirname=strtok(tmp_realFileName, "/")))
+ {
+ if(theRealFileName[0]=='/')
+ strcat(dirname, "/");
+ tmp2_dirname = strtok(NULL, "/");
+ while((tmp2_dirname))
+ {
+ strcat(dirname, tmp_dirname);
+ strcat(dirname, "/");
+ tmp_dirname = tmp2_dirname;
+ tmp2_dirname = strtok(NULL, "/");
+ }
+ }
+ theFileName = strcat(dirname, basename);
+#endif
}
else
{
@@ -436,9 +472,10 @@
goto failure;
}
- /* success: */
+ success:
MyFree(__FILE__, __LINE__, desc);
return YES;
+
/* Just in case the failure action needs to be changed. */
failure:

View File

@ -0,0 +1,75 @@
--- libPropList/configure.orig Mon Nov 2 08:38:32 1998
+++ libPropList/configure Tue Dec 15 10:35:19 1998
@@ -550,10 +550,11 @@
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:553: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
+# OpenBSD for some reason, thinks that $INSTALL is ../ bah!
+#if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
-else
+ else
IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH; do
# Account for people who put trailing slashes in PATH elements.
@@ -579,7 +580,7 @@
done
IFS="$ac_save_IFS"
-fi
+ fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL="$ac_cv_path_install"
else
@@ -589,7 +590,7 @@
# removed, or if the path is relative.
INSTALL="$ac_install_sh"
fi
-fi
+#fi
echo "$ac_t""$INSTALL" 1>&6
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
@@ -1413,6 +1414,40 @@
echo "$ac_t""no" 1>&6
fi
done
+
+
+echo $ac_n "checking for mkstemp""... $ac_c" 1>&6
+echo "configure:?: checking for mkstemp" >&5
+if eval "test \"`echo '$''{'ac_cv_func_mkstemp'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ eval "ac_cv_func_mkstemp=yes"
+else
+ cat>conftest.$ac_ext<<EOF
+#include <unistd.h>
+int main(){
+int i;char doh[12]={"/tmp/wmt.X"};
+i=mkstemp(doh);close(i);
+return 0;}
+EOF
+if { (eval echo configure:1859: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; test -s conftest;} then
+ rm -rf /tmp/wmt.*
+ eval "ac_cv_func_mkstemp=yes"
+else
+ echo "configure: failed program was:" >&5
+ ac_cv_func_mkstemp=-1
+fi
+rm conftest*
+fi
+
+echo "$ac_t""$ac_cv_func_mkstemp" 1>&6
+if test $ac_cv_func_mkstemp = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_MKSTEMP 1
+EOF
+
+fi
+
+
echo $ac_n "checking for working const""... $ac_c" 1>&6