File xdmbgrd-0.6.dif of Package xdmbgrd

Index: Makefile
===================================================================
---
 Makefile  |   16 ++++++++++------
 backgrd.c |   13 ++++++++++++-
 piggyback |   44 +++++++++++++++++++++++++++++++++++++-------
 3 files changed, 59 insertions(+), 14 deletions(-)

--- Makefile
+++ Makefile	2014-08-01 00:00:00.000000000 +0000
@@ -7,7 +7,8 @@ CC     = gcc
 COPTS  = $(RPM_OPT_FLAGS) -funroll-loops -pipe $(LOOP)
 CFLAGS = $(COPTS) -Wall -DUSEZLIB=$(USEZLIB)
 XLIBD  =
-SUSE   = SuSE_Linux_6
+openSUSE   = SuSE_Linux_6
+SLES	   = SuSE_Linux_7
 #
 # Force static linked libgz
 #
@@ -19,18 +20,21 @@ endif
 
 all: BackGround
 
-SuSE_Linux.h: SuSE_Linux.o
-SuSE_Linux.o: $(SUSE).xpm
-	./piggyback $(SUSE).xpm
+SuSE_Linux.h: openSuSE.o SLES.o
+openSuSE.o: $(openSUSE).xpm
+	bash -x ./piggyback -n $(basename $@) -h SuSE_Linux.h $?
+
+SLES.o: $(SLES).xpm
+	bash -x ./piggyback -n $(basename $@) -h SuSE_Linux.h $?
 
 backgrd.o:   backgrd.c SuSE_Linux.h
 unzip.o:     unzip.c
 login-pos.o: login-pos.c
 
-testt:  backgrd.c unzip.o login-pos.o SuSE_Linux.o
+testt:  backgrd.c unzip.o login-pos.o openSuSE.o SLES.o
 	$(CC) $(CFLAGS) -DMAIN -D_PROGRAM=\"xconsole\" -s -o $@ $^ $(LIBS)
 
-BackGround:  backgrd.c unzip.o login-pos.o SuSE_Linux.o
+BackGround:  backgrd.c unzip.o login-pos.o openSuSE.o SLES.o
 	$(CC) $(CFLAGS) -Wl,-no-warn-mismatch -DMAIN -D_PROGRAM=\"xlogin\" -o $@ $^ $(LIBS)
 
 clean:
--- backgrd.c
+++ backgrd.c	2014-08-01 00:00:00.000000000 +0000
@@ -37,7 +37,9 @@ static void setbackgrd (Display *dpy, ch
 int main ()
 {
     Display *dpy;
+    FILE * release = fopen("/etc/SuSE-release", "r");
     char *display_name = getenv("DISPLAY");
+    char buf[128];
     u_int out_len;
     char *output;
 
@@ -48,7 +50,16 @@ int main ()
 	exit(-1);
     }
 
-    get_pick(SuSE_Linux_data, SuSE_Linux_len, &output, &out_len);
+    if (!release)
+	get_pick(SLES_data, SLES_len, &output, &out_len);
+    else {
+	fgets(buf, sizeof(buf)-1, release);
+	fclose(release);
+	if (strncasecmp(buf, "opensuse", 8) == 0)
+	    get_pick(openSuSE_data, openSuSE_len, &output, &out_len);
+	else
+	    get_pick(SLES_data, SLES_len, &output, &out_len);
+    }
     setbackgrd(dpy, _PROGRAM, output);
     free(output);
 
--- piggyback
+++ piggyback	2014-08-01 00:00:00.000000000 +0000
@@ -4,10 +4,39 @@
     echo "Need file for encapsulation in object file" 1>&2
     exit 1
 }
+
+opt=;arg=
+while test "${1::1}" = "-" ; do
+    if test ${#1} -gt 2 -o "${2::1}" = "-" ; then
+        opt="$1"  ; shift
+    else
+        opt="$1$2"; shift 2
+    fi
+    arg="${opt:2}"
+    opt="${opt:1:1}"
+    arg="${arg%% }"
+    case "$opt" in
+    n) name="$arg" ;;
+    h) head="$arg" ;;
+    esac
+done
+
 fname=$1
 shift
 args="$@"
 
+if test -z "$name" ; then
+   name=${fname%%.*}
+   name=${name%_*}
+fi
+echo $head
+if test -z "$file" ; then
+   file=${name}.o
+fi
+if test -z "$head" ; then
+   head=${file%%.o}.h
+fi
+
 tmpfile=$$piggy.gz
 tmplink=$$piggy.lnk
 trap "rm -rf $tmpfile $tmplink" 0 1 2 3 5 9 10 13 15
@@ -57,10 +86,6 @@ case $arch in
 	ld_m=${1}
 	;;
 esac
-name=${fname%%.*}
-name=${name%_*}
-file=${name}.o
-head=${name}.h
 
 gzip -9 -f -n -q < $fname > $tmpfile
 
@@ -68,17 +93,22 @@ if type encaps > /dev/null 2>&1 ; then
     encaps -t $ld_b ${file} $tmpfile ${name}_data ${name}_len
 else
     echo \
-	"SECTIONS { .data : \
+        "SECTIONS { .data : ALIGN(8) \
 	    { \
 		${name}_len = .; \
 		LONG(${name}_data_end - ${name}_data) ${name}_data = .; \
 		*(.data) ${name}_data_end = .; \
  	    } \
 	} " > $tmplink
-    ld -no-warn-mismatch -m $ld_m -r -o ${file} -b binary $tmpfile -b $ld_b -T $tmplink
+    ld -no-warn-mismatch -m $ld_m -r -o ${file} ${obj} -b binary $tmpfile -b $ld_b -T $tmplink
 fi
 
-echo "/* Description of encapsulated file $fname */" > ${head}
+echo $head
+if ! test -s "${head}" ; then
+    echo "/* Description of encapsulated file $fname */" > ${head}
+else
+    echo "/* Description of encapsulated file $fname */" >> ${head}
+fi
 echo "extern char  ${name}_data[];" >> ${head}
 echo "extern int   ${name}_len;"  >> ${head}
 
openSUSE Build Service is sponsored by