--- xsudoky-1.0.5.orig/debian/changelog +++ xsudoky-1.0.5/debian/changelog @@ -0,0 +1,11 @@ +xsudoky (1.0.5-0miry2) jaunty; urgency=low + + * Adding missing dependencies: libx11-dev, pkg-config + + -- Miriam Ruiz Fri, 29 May 2009 01:23:32 +0200 + +xsudoky (1.0.5-0miry1) jaunty; urgency=low + + * Initial release + + -- Miriam Ruiz Fri, 22 May 2009 10:30:39 +0200 --- xsudoky-1.0.5.orig/debian/compat +++ xsudoky-1.0.5/debian/compat @@ -0,0 +1 @@ +7 --- xsudoky-1.0.5.orig/debian/Makefile +++ xsudoky-1.0.5/debian/Makefile @@ -0,0 +1,50 @@ +PROGRAM = xsudoky + +all: $(PROGRAM) + +SOURCES = sudoconfigure.c \ + sudobits.c \ + sudosymmetry.c \ + sudogui.c \ + sudoprint.c \ + sudorw.c \ + sudocolor.c \ + methods_1.c \ + methods_2.c \ + methods_3.c \ + methods_4.c \ + methods_5.c \ + sudobacktrack.c + +OBJS = $(SOURCES:.c=.o) + +PKGCONFIG=wx11 libxdg-basedir + +CFLAGS= -O2 -g -Wall +EXTRA_CFLAGS=-I../include `pkg-config --cflags $(PKGCONFIG)` + +LDFLAGS= -Wl,-z,defs -Wl,--as-needed -Wl,--no-undefined +EXTRA_LDFLAGS= +LIBS=`pkg-config --libs $(PKGCONFIG)` + +$(PROGRAM): $(OBJS) + gcc -o $@ $+ $(LDFLAGS) $(EXTRA_LDFLAGS) $(LIBS) + +%.o: %.cpp + g++ -o $@ -c $+ $(CFLAGS) $(EXTRA_CFLAGS) + +%.o: %.c + gcc -o $@ -c $+ $(CFLAGS) $(EXTRA_CFLAGS) + +clean: + rm -f $(PROGRAM) $(OBJS) *~ + +DESTDIR= +BINDIR=$(DESTDIR)/usr/games +DATADIR=$(DESTDIR)/usr/share/xsudoky + +install: $(PROGRAM) + mkdir -p "$(BINDIR)" + cp xsudoky $(BINDIR) + mkdir -p "$(DATADIR)" + cp -R ../games "$(DATADIR)" --- xsudoky-1.0.5.orig/debian/control +++ xsudoky-1.0.5/debian/control @@ -0,0 +1,38 @@ +Source: xsudoky +Section: games +Priority: extra +Maintainer: Miriam Ruiz +Build-Depends: debhelper (>= 7), dh-buildinfo, quilt, pkg-config, + libwx11-dev, libxdg-basedir-dev (>= 1.0.0), libx11-dev +Standards-Version: 3.8.1 +Homepage: http://xsudoky.sourceforge.net + +Package: xsudoky +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Suggests: xsudoky-dbg (= ${binary:Version}) +Description: sudoku player and solver + XSudoky lets you play and learn the methodologies of logical resolution + of sudoku puzzles by analyzing and highlighting them. You can learn + and understand strategies like: Intersection, Naked, Hidden, X-Wing, + Sword-Fish, Jelly-Fish, Squirm-Bag, XY-Wing, etc. + . + Different puzzles are already included in the game so you can directly + play them, but you can also download different ones by using a simple text + editor and an easy format. + +Package: xsudoky-dbg +Section: debug +Architecture: any +Depends: xsudoky (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: sudoku player and solver - debug + XSudoky lets you play and learn the methodologies of logical resolution + of sudoku puzzles by analyzing and highlighting them. You can learn + and understand strategies like: Intersection, Naked, Hidden, X-Wing, + Sword-Fish, Jelly-Fish, Squirm-Bag, XY-Wing, etc. + . + Different puzzles are already included in the game so you can directly + play them, but you can also download different ones by using a simple text + editor and an easy format. + . + This package contains the debugging symbols. --- xsudoky-1.0.5.orig/debian/manpage.1.ex +++ xsudoky-1.0.5/debian/manpage.1.ex @@ -0,0 +1,59 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH XSUDOKY SECTION "May 22, 2009" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +xsudoky \- program to do something +.SH SYNOPSIS +.B xsudoky +.RI [ options ] " files" ... +.br +.B bar +.RI [ options ] " files" ... +.SH DESCRIPTION +This manual page documents briefly the +.B xsudoky +and +.B bar +commands. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBxsudoky\fP is a program that... +.SH OPTIONS +These programs follow the usual GNU command line syntax, with long +options starting with two dashes (`-'). +A summary of options is included below. +For a complete description, see the Info files. +.TP +.B \-h, \-\-help +Show summary of options. +.TP +.B \-v, \-\-version +Show version of program. +.SH SEE ALSO +.BR bar (1), +.BR baz (1). +.br +The programs are documented fully by +.IR "The Rise and Fall of a Fooish Bar" , +available via the Info system. +.SH AUTHOR +xsudoky was written by . +.PP +This manual page was written by Miriam Ruiz , +for the Debian project (and may be used by others). --- xsudoky-1.0.5.orig/debian/copyright +++ xsudoky-1.0.5/debian/copyright @@ -0,0 +1,25 @@ +Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat +Upstream-Source: http://sourceforge.net/projects/xsudoky/ +Upstream-Maintainer: Max Cavallo +Debianized-By: Miriam Ruiz +Debianized-Date: Fri, 22 May 2009 10:32:25 +0200 + +Files: * +Copyright: Copyright (C) 2007-2009, Max Cavallo +Licence: GPL-2+ + +Files: debian/* +Copyright: Copyright (C) 2009, Miriam Ruiz +Licence: GPL-2+ + +Licence: GPL-2+ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + . + On Debian systems, the complete text of the latest version of the GNU + General Public License can be found in `/usr/share/common-licenses/GPL'. + . + The complete text of version 2 of the GNU General Public License can be + found in `/usr/share/common-licenses/GPL-2'. --- xsudoky-1.0.5.orig/debian/docs +++ xsudoky-1.0.5/debian/docs @@ -0,0 +1 @@ +NEWS --- xsudoky-1.0.5.orig/debian/rules +++ xsudoky-1.0.5/debian/rules @@ -0,0 +1,86 @@ +#!/usr/bin/make -f + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) +CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) +else +CROSS= --build $(DEB_BUILD_GNU_TYPE) +endif + +config: config-stamp +config-stamp: + dh_testdir + [ ! -d debian/patches ] || $(MAKE) -f /usr/share/quilt/quilt.make patch + ./configure --bindir=/usr/games --datadir=/usr/share + touch $@ + +build: build-stamp +build-stamp: config + dh_testdir + $(MAKE) -C src -f $(CURDIR)/debian/Makefile \ + CFLAGS="$(CFLAGS)" \ + LDFLAGS="-Wl,-z,defs -Wl,--as-needed -Wl,--no-undefined" + touch $@ + +clean: config + dh_testdir + dh_testroot + rm -f build-stamp config-stamp + [ ! -f $(CURDIR)/debian/Makefile ] || $(MAKE) -C src -f $(CURDIR)/debian/Makefile clean + rm -f Makefile src/config.h + [ ! -d debian/patches ] || $(MAKE) -f /usr/share/quilt/quilt.make unpatch + dh_clean + +DESTDIR=$(CURDIR)/debian/xsudoky + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + $(MAKE) -C src -f $(CURDIR)/debian/Makefile install DESTDIR="$(CURDIR)/debian/xsudoky" + +# Build architecture-independent files here. +binary-indep: install + +# Build architecture-dependent files here. +binary-arch: install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman +# dh_desktop + dh_link + dh_strip --dbg-package=xsudoky-dbg + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + [ ! -e /usr/bin/dh_buildinfo ] || dh_buildinfo + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: config build clean binary-indep binary-arch binary install --- xsudoky-1.0.5.orig/debian/README.Debian +++ xsudoky-1.0.5/debian/README.Debian @@ -0,0 +1,6 @@ +xsudoky for Debian +------------------ + + + + -- Miriam Ruiz Fri, 22 May 2009 10:30:39 +0200 --- xsudoky-1.0.5.orig/debian/patches/xdg.patch +++ xsudoky-1.0.5/debian/patches/xdg.patch @@ -0,0 +1,308 @@ +--- xsudoky-1.0.5.orig/src/sudoconfigure.c ++++ xsudoky-1.0.5/src/sudoconfigure.c +@@ -2,6 +2,9 @@ + #include + #include + ++#include ++#include ++ + #include + /* + #include +@@ -65,30 +68,23 @@ + int xsudoky_config_writing_file (int *COLOR_THEME, int *SHOWCANDI,int *SOLVE_MODE,int *FULL_GAME) + { + FILE *file, *fopen(); +- char *homeuser=getenv("HOME"); + char *buff; + + buff=malloc(128); + +- // +- // '.xphonya' directory exist? +- // +- sprintf (buff,"%s/.xsudoky",homeuser); +- file = fopen(buff, "r"); +- if (!file) +- { +- // +- // if not exist create directory +- // +- mkdir(buff,0700); +- } +- else +- { +- fclose (file); +- } +- ++ xdgHandle xdg_handle; ++ if (xdgInitHandle(&xdg_handle)) ++ { ++ snprintf (buff,128,"%s/xsudoky",xdgConfigHome(&xdg_handle)); ++ xdgMakePath(buff, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); ++ snprintf (buff,128,"%s/xsudoky/config",xdgConfigHome(&xdg_handle)); ++ xdgWipeHandle(&xdg_handle); ++ } else { ++ printf ("Cannot Init XDG Handle\n"); ++ free(buff); ++ return (-1); ++ } + +- sprintf (buff,"%s/.xsudoky/config",homeuser); + file = fopen(buff, "w"); + if (!file) + { +@@ -124,7 +120,6 @@ + // + // + FILE *file, *fopen(); +- char *homeuser=getenv("HOME"); + char *buff; + int pos=0, pos2=0; + // +@@ -132,10 +127,18 @@ + + buff=malloc(128); + ++ xdgHandle xdg_handle; ++ if (xdgInitHandle(&xdg_handle)) ++ { ++ snprintf (buff,128,"%s/xsudoky/config",xdgConfigHome(&xdg_handle)); ++ xdgWipeHandle(&xdg_handle); ++ } else { ++ *buff=0; ++ } ++ + // + // 'config' file exist? + // +- sprintf (buff,"%s/.xsudoky/config",homeuser); + file = fopen(buff, "r"); + if (file) + { +--- xsudoky-1.0.5.orig/src/sudorw.c ++++ xsudoky-1.0.5/src/sudorw.c +@@ -2,6 +2,9 @@ + #include + #include + ++#include ++#include ++ + char * extract_filename (char *pathname, char *filename) + { + // +@@ -33,7 +36,22 @@ + + CORSAVED--; + +- sprintf (BUFF,"%s/%s.%03d",DIR_SAVED,"game",CORSAVED); ++ xdgHandle xdg_handle; ++ if (!xdgInitHandle(&xdg_handle)) ++ { ++ char err[64]; ++ sprintf ( ++ err, ++ gettext("Error opening %s"),BUFF); ++ WX11_Alert ( ++ err, ++ gettext("Ok"),NULL); ++ return (1); ++ } ++ snprintf (BUFF,sizeof(BUFF),"%s/%s",xdgDataHome(&xdg_handle),DIR_SAVED); ++ xdgMakePath(BUFF, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); ++ snprintf (BUFF,sizeof(BUFF),"%s/%s/%s.%03d",xdgDataHome(&xdg_handle),DIR_SAVED,"game",CORSAVED); ++ xdgWipeHandle(&xdg_handle); + + Clear_Comments(); + ResetGame(0x00); +@@ -71,7 +89,22 @@ + + CORSAVED++; + +- sprintf (BUFF,"%s/%s.%03d",DIR_SAVED,"game",CORSAVED); ++ xdgHandle xdg_handle; ++ if (!xdgInitHandle(&xdg_handle)) ++ { ++ char err[64]; ++ sprintf ( ++ err, ++ gettext("Error opening %s"),BUFF); ++ WX11_Alert ( ++ err, ++ gettext("Ok"),NULL); ++ return (1); ++ } ++ snprintf (BUFF,sizeof(BUFF),"%s/%s",xdgDataHome(&xdg_handle),DIR_SAVED); ++ xdgMakePath(BUFF, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); ++ snprintf (BUFF,sizeof(BUFF),"%s/%s/%s.%03d",xdgDataHome(&xdg_handle),DIR_SAVED,"game",CORSAVED); ++ xdgWipeHandle(&xdg_handle); + + Clear_Comments(); + ResetGame(0x00); +@@ -109,8 +142,23 @@ + int x,y; + FILE *out, *fopen(); + ++ xdgHandle xdg_handle; ++ if (!xdgInitHandle(&xdg_handle)) ++ { ++ char err[64]; ++ sprintf ( ++ err, ++ gettext("Error opening %s"),BUFF); ++ WX11_Alert ( ++ err, ++ gettext("Ok"),NULL); ++ return (1); ++ } ++ snprintf (BUFF,sizeof(BUFF),"%s/%s",xdgDataHome(&xdg_handle),DIR_SAVED); ++ xdgMakePath(BUFF, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); ++ snprintf (BUFF,sizeof(BUFF),"%s/%s/%s.%03d",xdgDataHome(&xdg_handle),DIR_SAVED,"game",CORSAVED+1); ++ xdgWipeHandle(&xdg_handle); + +- sprintf (BUFF,"%s/%s.%03d",DIR_SAVED,"game",CORSAVED+1); + out = fopen(BUFF, "w"); + if (!out) + { +--- xsudoky-1.0.5.orig/src/sudogui.c ++++ xsudoky-1.0.5/src/sudogui.c +@@ -11,6 +11,9 @@ + #include "sudoky.h" + extern int WX11_INTERLINE_SPACE; + ++#include ++#include ++ + Timer *timer_s; + char ctimer[30]; + +@@ -811,10 +814,21 @@ + + int SudokyApri () + { ++ char *CurDir=NULL; + char *CurFile=NULL; + +- CurFile=WX11_Files(gettext(" Open... "),DIR_GAMES,NULL); ++ xdgHandle xdg_handle; ++ if (xdgInitHandle(&xdg_handle)) ++ { ++ CurDir=xdgDataFind(DIR_GAMES, &xdg_handle); ++ } else { ++ printf ("Cannot Init XDG Handle\n"); ++ return (0); ++ } ++ ++ CurFile=WX11_Files(gettext(" Open... "),CurDir,NULL); + printf ("Loading %s\n",CurFile); ++ if (CurDir) free(CurDir); + if (CurFile==NULL) return (0); + + if (SudokuLoad (CurFile)) +@@ -862,13 +876,23 @@ + int SudokySalva () + { + char *CurFile=NULL; +- //char *penv; + +- //penv=getenv("HOME"); +- //if (penv) +- // CurFile=WX11_Files(gettext("Save..."),penv,NULL); +- //else +- CurFile=WX11_Files(gettext("Save..."), DIR_GAMES,NULL); ++ char *buff=malloc(128); ++ xdgHandle xdg_handle; ++ if (xdgInitHandle(&xdg_handle)) ++ { ++ snprintf (buff,128,"%s/%s",xdgDataHome(&xdg_handle),DIR_GAMES); ++ xdgMakePath(buff, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); ++ xdgWipeHandle(&xdg_handle); ++ } else { ++ printf ("Cannot Init XDG Handle\n"); ++ free(buff); ++ return (-1); ++ } ++ ++ CurFile=WX11_Files(gettext("Save..."),buff,NULL); ++ ++ free(buff); + + if (CurFile==NULL) return (0); + +@@ -899,17 +923,28 @@ + struct dirent **files; + int TotaleFiles,x; + char CurFile[128]; ++ char *CurDir=NULL; + + int sud_file_select(); + +- TotaleFiles=scandir(DIR_GAMES,&files,sud_file_select,alphasort); +- if (TotaleFiles==-1) ++ xdgHandle xdg_handle; ++ if (xdgInitHandle(&xdg_handle)) + { +- printf ("File(s) not found in %s\nPlease type 'make install' as root\n",DIR_GAMES); ++ CurDir=xdgDataFind(DIR_GAMES, &xdg_handle); ++ } else { ++ printf ("Cannot Init XDG Handle\n"); ++ return (0); ++ } ++ ++ TotaleFiles=scandir(CurDir,&files,sud_file_select,alphasort); ++ if (TotaleFiles<=0) ++ { ++ printf ("File(s) not found in %s\n",CurDir); ++ if (CurDir) free(CurDir); + exit (1); + } + +- sprintf (CurFile,"%s/%s",DIR_GAMES,files[(getrand (TotaleFiles))]->d_name); ++ snprintf (CurFile,sizeof(CurFile),"%s/%s",CurDir,files[(getrand (TotaleFiles))]->d_name); + + for (x=0;xd_name); ++ char *CurDir=NULL; ++ ++ xdgHandle xdg_handle; ++ if (xdgInitHandle(&xdg_handle)) ++ { ++ CurDir=xdgDataFind(DIR_GAMES, &xdg_handle); ++ } else { ++ printf ("Cannot Init XDG Handle\n"); ++ return (1); ++ } ++ ++ snprintf (buff,64,"%s/%s",CurDir,entry->d_name); ++ if (CurDir) free(CurDir); + stat (buff,&stat_buf); + if((stat_buf.st_mode & S_IFMT) == S_IFDIR) + return (0); +--- xsudoky-1.0.5.orig/src/sudoky.h ++++ xsudoky-1.0.5/src/sudoky.h +@@ -33,8 +33,8 @@ + #define START_WITH_FULL_GAME + //"/usr/local/share/xsudoky/" + #define _DIR_DAT DATADIR "/" PACKAGE "/" +-#define DIR_SAVED _DIR_DAT "saved" +-#define DIR_GAMES _DIR_DAT "games" ++#define DIR_SAVED PACKAGE "/" "saved" ++#define DIR_GAMES PACKAGE "/" "games" + #define DIR_PO _DIR_DAT "po" + + #define SUD_TAB 9 // Tavola 9x9 --- xsudoky-1.0.5.orig/debian/patches/buffers.patch +++ xsudoky-1.0.5/debian/patches/buffers.patch @@ -0,0 +1,556 @@ +--- xsudoky-1.0.5.orig/src/sudoconfigure.c ++++ xsudoky-1.0.5/src/sudoconfigure.c +@@ -6,6 +6,7 @@ + #include + + #include ++#include + /* + #include + #include +@@ -68,37 +69,33 @@ + int xsudoky_config_writing_file (int *COLOR_THEME, int *SHOWCANDI,int *SOLVE_MODE,int *FULL_GAME) + { + FILE *file, *fopen(); +- char *buff; +- +- buff=malloc(128); + ++ char FileName[PATH_MAX]; + xdgHandle xdg_handle; + if (xdgInitHandle(&xdg_handle)) + { +- snprintf (buff,128,"%s/xsudoky",xdgConfigHome(&xdg_handle)); +- xdgMakePath(buff, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); +- snprintf (buff,128,"%s/xsudoky/config",xdgConfigHome(&xdg_handle)); ++ snprintf (FileName,sizeof(FileName),"%s/xsudoky",xdgConfigHome(&xdg_handle)); ++ xdgMakePath(FileName, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); ++ snprintf (FileName,sizeof(FileName),"%s/xsudoky/config",xdgConfigHome(&xdg_handle)); + xdgWipeHandle(&xdg_handle); + } else { + printf ("Cannot Init XDG Handle\n"); +- free(buff); + return (-1); + } + +- file = fopen(buff, "w"); ++ file = fopen(FileName, "w"); + if (!file) + { + // + // Error + // +- printf ("Cannot Create %s file\n",buff); +- free(buff); ++ printf ("Cannot Create %s file\n",FileName); + return (-1); + } + // +- // defualt parameters ++ // default parameters + // +- printf ("Writing xsudoky config (%s)\n",buff); ++ printf ("Writing xsudoky config (%s)\n",FileName); + // + fputs("#\n# xsudoky - config\n#\n\n",file); + // +@@ -108,7 +105,6 @@ + // + // + fclose (file); +- free(buff); + // + //xsudoky_config_reading_file (); + // +@@ -127,25 +123,26 @@ + + buff=malloc(128); + ++ char FileName[PATH_MAX]; + xdgHandle xdg_handle; + if (xdgInitHandle(&xdg_handle)) + { +- snprintf (buff,128,"%s/xsudoky/config",xdgConfigHome(&xdg_handle)); ++ snprintf (FileName,sizeof(FileName),"%s/xsudoky/config",xdgConfigHome(&xdg_handle)); + xdgWipeHandle(&xdg_handle); + } else { +- *buff=0; ++ *FileName=0; + } + + // + // 'config' file exist? + // +- file = fopen(buff, "r"); ++ file = fopen(FileName, "r"); + if (file) + { + // + // if file exist reading parameters + // +- printf ("Reading xsudoky config (%s)\n",buff); ++ printf ("Reading xsudoky config (%s)\n",FileName); + while (!feof(file)) + { + if (fgets(buff, 128, file)!=NULL) +--- xsudoky-1.0.5.orig/src/sudogui.c ++++ xsudoky-1.0.5/src/sudogui.c +@@ -38,7 +38,7 @@ + + void sudoStoreName () + { +- sprintf (BUFF,"%s - %s",FILENAME,PACKAGE); ++ snprintf (BUFF,sizeof(BUFF),"%s - %s",FILENAME,PACKAGE); + XStoreName(WX11_GetDisplay(), PrimoComando(0,NULL)->win, BUFF); + } + +@@ -82,7 +82,7 @@ + { + for (x=0;xTipo=BUTTON; + cella->Fg=CANDI_COLOR; +@@ -374,7 +374,7 @@ + } + if (par==NULL) + { +- sprintf (BUFF,gettext("Cell R%dC%d [%s]\n \nNumber to insert? "), ++ snprintf (BUFF,sizeof(BUFF),gettext("Cell R%dC%d [%s]\n \nNumber to insert? "), + y+1,x+1,candidati_old); + + c=WX11_Alert (BUFF,"1","2","3","4","5","6","7","8","9",NULL); +@@ -387,7 +387,7 @@ + { + if (strchr(candidati_old, c+'0')==0) + { +- sprintf (BUFF, ++ snprintf (BUFF,sizeof(BUFF), + gettext("Warning!!!\n The Number [%d] in R%dC%d is not correct"), + c,y+1,x+1); + +@@ -405,7 +405,7 @@ + Clear_Comments (); + WX11_ListCmdItemAdd (ViewComment, LABEL, + gettext("MANUAL INSERT")); +- sprintf (BUFF, ++ snprintf (BUFF,sizeof(BUFF), + gettext(" Set [%d] in R%dC%d"),c,y+1,x+1); + WX11_ListCmdItemAdd (ViewComment, LIST_BOX, BUFF); + SudoFinish(1); +@@ -470,7 +470,7 @@ + + if (par==NULL) + { +- sprintf (BUFF, ++ snprintf (BUFF,sizeof(BUFF), + gettext("Cell R%dC%d [%s]\n \nCandidate to remove?"), + y+1,x+1,candidati_old); + +@@ -483,7 +483,7 @@ + + if (strchr(candidati_old, c+'0')==0) + { +- sprintf (BUFF, ++ snprintf (BUFF,sizeof(BUFF), + gettext("Warning!!!\n The canditate [%d] in R%dC%d not exist"), + c,y+1,x+1); + +@@ -499,7 +499,7 @@ + Clear_Comments (); + WX11_ListCmdItemAdd (ViewComment, LABEL, + gettext("MANUAL REMOVE CANDIDATE")); +- sprintf (BUFF, ++ snprintf (BUFF,sizeof(BUFF), + gettext(" Unset [%d] in R%dC%d -> [%s]"), + c,y+1,x+1,GetCandidati(y,x)); + WX11_ListCmdItemAdd (ViewComment, LIST_BOX, BUFF); +@@ -529,7 +529,7 @@ + if (x && ((x % DIVX)==0)) + posx=posx+dimgap; + +- sprintf (LABELCOLONNA[x],"C%d",x+1); ++ snprintf (LABELCOLONNA[x],sizeof(LABELCOLONNA[x]),"C%d",x+1); + + cmd=ApreBottone(area_sudo, + posx, +@@ -550,7 +550,7 @@ + posy=posy+dimgap; + + posx=4; +- sprintf (LABELRIGA[y],"R%d",y+1); ++ snprintf (LABELRIGA[y],sizeof(LABELRIGA[y]),"R%d",y+1); + + WX11_FontOpen (FONTDEFAULT); + cmd=ApreBottone(area_sudo, +@@ -617,9 +617,9 @@ + // Swap to Hidden/Show Candi + // + if (SHOW_CANDI) +- sprintf (BUFF,gettext("Hidden candidates")); ++ snprintf (BUFF,sizeof(BUFF),gettext("Hidden candidates")); + if (!SHOW_CANDI) +- sprintf (BUFF,gettext("Show candidates")); ++ snprintf (BUFF,sizeof(BUFF),gettext("Show candidates")); + // + //WX11_ListCmdItemAdd (ViewComment, LABEL, BUFF); + +@@ -675,10 +675,10 @@ + if (lang) + { + lang[2]='\0'; +- sprintf (freadme,"%s/%s/LC_MESSAGES/%s",DIR_PO,lang,fname); ++ snprintf (freadme,sizeof(freadme),"%s/%s/LC_MESSAGES/%s",DIR_PO,lang,fname); + } + else +- sprintf (freadme,"%s/%s/LC_MESSAGES/%s",DIR_PO,"en",fname); ++ sprintf (freadme,sizeof(freadme),"%s/%s/LC_MESSAGES/%s",DIR_PO,"en",fname); + + printf ("%s\n",freadme); + WX11_ViewFile (freadme,fname,400,400); +@@ -692,48 +692,48 @@ + // + if (Type==0x00) + { +- sprintf (BUFF,gettext("Warning!!! The puzzle has not Symmetry")); ++ snprintf (BUFF,sizeof(BUFF),gettext("Warning!!! The puzzle has not Symmetry")); + WX11_ListCmdItemAdd (ViewComment, LABEL, BUFF); + } + if (Type==0x3F) + { +- sprintf (BUFF,gettext("The puzzle has a full dihedral symmetry.")); ++ snprintf (BUFF,sizeof(BUFF),gettext("The puzzle has a full dihedral symmetry.")); + WX11_ListCmdItemAdd (ViewComment, LABEL, BUFF); + Type=0; + } + if (Type&32) + { +- sprintf (BUFF,gettext("The puzzle has a Full rotational symmetry")); ++ snprintf (BUFF,sizeof(BUFF),gettext("The puzzle has a Full rotational symmetry")); + WX11_ListCmdItemAdd (ViewComment, LABEL, BUFF); + Type=0; + } + if (Type&16) + { +- sprintf (BUFF,gettext("The puzzle has a Horizzontal and Vertical reflection symmetry")); ++ snprintf (BUFF,sizeof(BUFF),gettext("The puzzle has a Horizzontal and Vertical reflection symmetry")); + WX11_ListCmdItemAdd (ViewComment, LABEL, BUFF); + Type=0; + } + if (Type&8) + { +- sprintf (BUFF,gettext("The puzzle has a Diagonal and anti-diagonal reflection symmetry")); ++ snprintf (BUFF,sizeof(BUFF),gettext("The puzzle has a Diagonal and anti-diagonal reflection symmetry")); + WX11_ListCmdItemAdd (ViewComment, LABEL, BUFF); + Type=0; + } + if (Type&4) + { +- sprintf (BUFF,gettext("The puzzle has 180%c rotational symmetry"),176); ++ snprintf (BUFF,sizeof(BUFF),gettext("The puzzle has 180%c rotational symmetry"),176); + WX11_ListCmdItemAdd (ViewComment, LABEL, BUFF); + Type=0; + } + if (Type&2) + { +- sprintf (BUFF,gettext("The puzzle has Horizzontal or Vertical reflection")); ++ snprintf (BUFF,sizeof(BUFF),gettext("The puzzle has Horizzontal or Vertical reflection")); + WX11_ListCmdItemAdd (ViewComment, LABEL, BUFF); + Type=0; + } + if (Type&1) + { +- sprintf (BUFF,gettext("The puzzle has Diagonal or anti-diagonal reflection")); ++ snprintf (BUFF,sizeof(BUFF),gettext("The puzzle has Diagonal or anti-diagonal reflection")); + WX11_ListCmdItemAdd (ViewComment, LABEL, BUFF); + Type=0; + } +@@ -876,23 +876,20 @@ + int SudokySalva () + { + char *CurFile=NULL; ++ char FileName[PATH_MAX]; + +- char *buff=malloc(128); + xdgHandle xdg_handle; + if (xdgInitHandle(&xdg_handle)) + { +- snprintf (buff,128,"%s/%s",xdgDataHome(&xdg_handle),DIR_GAMES); +- xdgMakePath(buff, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); ++ snprintf (FileName,sizeof(FileName),"%s/%s",xdgDataHome(&xdg_handle),DIR_GAMES); ++ xdgMakePath(FileName, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + xdgWipeHandle(&xdg_handle); + } else { + printf ("Cannot Init XDG Handle\n"); +- free(buff); + return (-1); + } + +- CurFile=WX11_Files(gettext("Save..."),buff,NULL); +- +- free(buff); ++ CurFile=WX11_Files(gettext("Save..."),FileName,NULL); + + if (CurFile==NULL) return (0); + +@@ -922,7 +919,7 @@ + { + struct dirent **files; + int TotaleFiles,x; +- char CurFile[128]; ++ char FileName[PATH_MAX]; + char *CurDir=NULL; + + int sud_file_select(); +@@ -944,20 +941,20 @@ + exit (1); + } + +- snprintf (CurFile,sizeof(CurFile),"%s/%s",CurDir,files[(getrand (TotaleFiles))]->d_name); ++ snprintf (FileName,sizeof(FileName),"%s/%s",CurDir,files[(getrand (TotaleFiles))]->d_name); + + for (x=0;x48 && *tasto<58) + { +- sprintf (BUFF,"X%d%d",y,x); ++ snprintf (BUFF,sizeof(BUFF),"X%d%d",y,x); + cella=CercaNomeComando (BUFF); + + if (WX11_IsShift (state)) +@@ -1191,25 +1188,25 @@ + if (xsym==XK_Up) + { + y--; if (y < 0) y=9-1; +- sprintf (BUFF,"X%d%d",y,x); ++ snprintf (BUFF,sizeof(BUFF),"X%d%d",y,x); + cella=CercaNomeComando (BUFF); + } + if (xsym==XK_Down) + { + y++; if (y == 9) y=0; +- sprintf (BUFF,"X%d%d",y,x); ++ snprintf (BUFF,sizeof(BUFF),"X%d%d",y,x); + cella=CercaNomeComando (BUFF); + } + if (xsym==XK_Left) + { + x--; if (x < 0) x=9-1; +- sprintf (BUFF,"X%d%d",y,x); ++ snprintf (BUFF,sizeof(BUFF),"X%d%d",y,x); + cella=CercaNomeComando (BUFF); + } + if (xsym==XK_Right) + { + x++; if (x == 9) x=0; +- sprintf (BUFF,"X%d%d",y,x); ++ snprintf (BUFF,sizeof(BUFF),"X%d%d",y,x); + cella=CercaNomeComando (BUFF); + } + if (cella) +@@ -1257,7 +1254,7 @@ + + if (WX11_GetDepth ()< 15) + { +- sprintf (BUFF,"Warning!!!\nYou must have 15 or more bit depth color! You have %d-bit now!",WX11_GetDepth ()); ++ snprintf (BUFF,sizeof(BUFF),"Warning!!!\nYou must have 15 or more bit depth color! You have %d-bit now!",WX11_GetDepth ()); + WX11_Alert (BUFF,"Ok",NULL); + } + +--- xsudoky-1.0.5.orig/src/sudorw.c ++++ xsudoky-1.0.5/src/sudorw.c +@@ -40,27 +40,27 @@ + if (!xdgInitHandle(&xdg_handle)) + { + char err[64]; +- sprintf ( +- err, +- gettext("Error opening %s"),BUFF); ++ snprintf (err,sizeof(err), ++ gettext("Cannot Init XDG Handle")); + WX11_Alert ( + err, + gettext("Ok"),NULL); + return (1); + } +- snprintf (BUFF,sizeof(BUFF),"%s/%s",xdgDataHome(&xdg_handle),DIR_SAVED); +- xdgMakePath(BUFF, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); +- snprintf (BUFF,sizeof(BUFF),"%s/%s/%s.%03d",xdgDataHome(&xdg_handle),DIR_SAVED,"game",CORSAVED); ++ char FileName[PATH_MAX]; ++ snprintf (FileName,sizeof(FileName),"%s/%s",xdgDataHome(&xdg_handle),DIR_SAVED); ++ xdgMakePath(FileName, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); ++ snprintf (FileName,sizeof(FileName),"%s/%s/%s.%03d",xdgDataHome(&xdg_handle),DIR_SAVED,"game",CORSAVED); + xdgWipeHandle(&xdg_handle); + + Clear_Comments(); + ResetGame(0x00); + +- CaricaGame (BUFF); ++ CaricaGame (FileName); + + Redisplay(0); + +- sprintf (STEP,"%d/%d",CORSAVED,MAXSAVED); ++ snprintf (STEP,sizeof(STEP),"%d/%d",CORSAVED,MAXSAVED); + WX11_CmdLabelChange(CmdStep,STEP); + + return (0); +@@ -95,25 +95,26 @@ + char err[64]; + sprintf ( + err, +- gettext("Error opening %s"),BUFF); ++ gettext("Cannot Init XDG Handle")); + WX11_Alert ( + err, + gettext("Ok"),NULL); + return (1); + } +- snprintf (BUFF,sizeof(BUFF),"%s/%s",xdgDataHome(&xdg_handle),DIR_SAVED); +- xdgMakePath(BUFF, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); +- snprintf (BUFF,sizeof(BUFF),"%s/%s/%s.%03d",xdgDataHome(&xdg_handle),DIR_SAVED,"game",CORSAVED); ++ char FileName[PATH_MAX]; ++ snprintf (FileName,sizeof(FileName),"%s/%s",xdgDataHome(&xdg_handle),DIR_SAVED); ++ xdgMakePath(FileName, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); ++ snprintf (FileName,sizeof(FileName),"%s/%s/%s.%03d",xdgDataHome(&xdg_handle),DIR_SAVED,"game",CORSAVED); + xdgWipeHandle(&xdg_handle); + + Clear_Comments(); + ResetGame(0x00); + +- CaricaGame (BUFF); ++ CaricaGame (FileName); + + Redisplay(0); + +- sprintf (STEP,"%d/%d",CORSAVED,MAXSAVED); ++ snprintf (STEP,sizeof(STEP),"%d/%d",CORSAVED,MAXSAVED); + WX11_CmdLabelChange(CmdStep,STEP); + + return (0); +@@ -148,24 +149,25 @@ + char err[64]; + sprintf ( + err, +- gettext("Error opening %s"),BUFF); ++ gettext("Cannot Init XDG Handle")); + WX11_Alert ( + err, + gettext("Ok"),NULL); + return (1); + } +- snprintf (BUFF,sizeof(BUFF),"%s/%s",xdgDataHome(&xdg_handle),DIR_SAVED); +- xdgMakePath(BUFF, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); +- snprintf (BUFF,sizeof(BUFF),"%s/%s/%s.%03d",xdgDataHome(&xdg_handle),DIR_SAVED,"game",CORSAVED+1); ++ char FileName[PATH_MAX]; ++ snprintf (FileName,sizeof(FileName),"%s/%s",xdgDataHome(&xdg_handle),DIR_SAVED); ++ xdgMakePath(FileName, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); ++ snprintf (FileName,sizeof(FileName),"%s/%s/%s.%03d",xdgDataHome(&xdg_handle),DIR_SAVED,"game",CORSAVED+1); + xdgWipeHandle(&xdg_handle); + +- out = fopen(BUFF, "w"); ++ out = fopen(FileName, "w"); + if (!out) + { + char err[64]; + sprintf ( + err, +- gettext("Error opening %s"),BUFF); ++ gettext("Error opening %s"),FileName); + WX11_Alert ( + err, + gettext("Ok"),NULL); +@@ -202,7 +204,7 @@ + CORSAVED++; + MAXSAVED=CORSAVED; + +- sprintf (STEP,"%d/%d",CORSAVED,MAXSAVED); ++ snprintf (STEP,sizeof(STEP),"%d/%d",CORSAVED,MAXSAVED); + WX11_CmdLabelChange(CmdStep,STEP); + + +@@ -233,7 +235,7 @@ + in = fopen(filename, "r"); + if (!in) + { +- sprintf (BUFF,gettext("Error opening %s"),filename); ++ snprintf (BUFF,sizeof(BUFF),gettext("Error opening %s"),filename); + printf ("%s\n",BUFF); + WX11_Alert (BUFF,gettext("Ok"),NULL); + return (1); +@@ -366,8 +368,7 @@ + out = fopen(filename, "w"); + if (!out) + { +- sprintf ( +- BUFF, ++ snprintf (BUFF,sizeof(BUFF), + gettext("Error writing %s"),filename); + WX11_Alert ( + BUFF, +@@ -391,7 +392,7 @@ + } + fclose (out); + +- sprintf (BUFF,gettext("Game \"%s\" saved"),filename); ++ snprintf (BUFF,sizeof(BUFF),gettext("Game \"%s\" saved"),filename); + WX11_Alert (BUFF,gettext("Ok"),NULL); + + return (0); --- xsudoky-1.0.5.orig/debian/patches/series +++ xsudoky-1.0.5/debian/patches/series @@ -0,0 +1,2 @@ +xdg.patch +buffers.patch