[xedit] Initial import (#815624).
pcpa
pcpa at fedoraproject.org
Tue Jul 3 13:24:36 UTC 2012
commit abfe38b502b44429a219dd392ec2765545b96237
Author: pcpa <paulo.cesar.pereira.de.andrade at gmail.com>
Date: Tue Jul 3 10:24:13 2012 -0400
Initial import (#815624).
.gitignore | 1 +
...back-implementation-of-missing-libc-funct.patch | 934 ++++++++++++++++++++
...ect-64-bit-overflow-check-and-bignum-code.patch | 216 +++++
...pointer-when-computing-realpath-of-a-new-.patch | 30 +
...ems-with-builds-with-Werror-format-securi.patch | 41 +
sources | 1 +
xedit.desktop | 8 +
xedit.spec | 70 ++
8 files changed, 1301 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..1735fd1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/xedit-1.2.0.tar.bz2
diff --git a/0001-Update-fallback-implementation-of-missing-libc-funct.patch b/0001-Update-fallback-implementation-of-missing-libc-funct.patch
new file mode 100644
index 0000000..ac1ddb1
--- /dev/null
+++ b/0001-Update-fallback-implementation-of-missing-libc-funct.patch
@@ -0,0 +1,934 @@
+From 3b23cf388ef088bea1408aeab1eb6b5e3602086a Mon Sep 17 00:00:00 2001
+From: pcpa <paulo.cesar.pereira.de.andrade at gmail.com>
+Date: Thu, 24 May 2012 14:40:35 -0300
+Subject: [PATCH 1/4] Update fallback implementation of missing libc functions
+
+ This commit updates realpath.c from
+http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/realpath.c?rev=1.14;content-type=text/plain
+and lisp/env.c from
+http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/getenv.c?rev=1.10;content-type=text/plain
+and
+http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/setenv.c?rev=1.13;content-type=text/plain
+
+ The update reason is to replace files under "4 clause BSD", that
+is considered problematic or require special documentation notation
+or conditions when redistributing free software.
+
+Signed-off-by: pcpa <paulo.cesar.pereira.de.andrade at gmail.com>
+---
+ AUTHORS | 2 +-
+ COPYING | 50 +++++++---
+ Makefile.am | 3 +-
+ lisp/env.c | 151 ----------------------------
+ lisp/getenv.c | 81 +++++++++++++++
+ lisp/setenv.c | 178 +++++++++++++++++++++++++++++++++
+ realpath.c | 306 +++++++++++++++++++++++++++++----------------------------
+ 7 files changed, 451 insertions(+), 320 deletions(-)
+ delete mode 100644 lisp/env.c
+ create mode 100644 lisp/getenv.c
+ create mode 100644 lisp/setenv.c
+
+diff --git a/AUTHORS b/AUTHORS
+index 65e5b4c..60c1d32 100644
+--- a/AUTHORS
++++ b/AUTHORS
+@@ -135,7 +135,7 @@ Files required for systems that don't have the required calls in the
+ standard libraries:
+
+ (Based on Copyright notice)
+-Jan-Simon Pendry
++Constantin S. Svintsoff
+ realpath.c
+
+ (No author information, using CVS tag)
+diff --git a/COPYING b/COPYING
+index 4e83706..a2c9fab 100644
+--- a/COPYING
++++ b/COPYING
+@@ -1,6 +1,35 @@
++Copyright (c) 2003 Constantin S. Svintsoff <kostik at iclub.nsu.ru>
++
++Redistribution and use in source and binary forms, with or without
++modification, are permitted provided that the following conditions
++are met:
++1. Redistributions of source code must retain the above copyright
++ notice, this list of conditions and the following disclaimer.
++2. Redistributions in binary form must reproduce the above copyright
++ notice, this list of conditions and the following disclaimer in the
++ documentation and/or other materials provided with the distribution.
++3. The names of the authors may not be used to endorse or promote
++ products derived from this software without specific prior written
++ permission.
++
++THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
++FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++SUCH DAMAGE.
++
++
++
++
+
+ Copyright (c) 1987, 1993
+- The Regents of the University of California. All rights reserved.
++ The Regents of the University of California. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+@@ -10,11 +39,7 @@ are met:
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+-3. All advertising materials mentioning features or use of this software
+- must display the following acknowledgement:
+- This product includes software developed by the University of
+- California, Berkeley and its contributors.
+-4. Neither the name of the University nor the names of its contributors
++3. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+@@ -34,11 +59,8 @@ SUCH DAMAGE.
+
+
+
+-Copyright (c) 1994
+- The Regents of the University of California. All rights reserved.
+-
+-This code is derived from software contributed to Berkeley by
+-Jan-Simon Pendry.
++Copyright (c) 1987 Regents of the University of California.
++All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+@@ -48,11 +70,7 @@ are met:
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+-3. All advertising materials mentioning features or use of this software
+- must display the following acknowledgement:
+- This product includes software developed by the University of
+- California, Berkeley and its contributors.
+-4. Neither the name of the University nor the names of its contributors
++3. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+diff --git a/Makefile.am b/Makefile.am
+index fc7a74c..16a01d6 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -85,7 +85,8 @@ liblisp_a_SOURCES = \
+ lisp/xedit.h
+
+ if NEED_UNSETENV
+-liblisp_a_SOURCES += lisp/env.c
++liblisp_a_SOURCES += lisp/getenv.c
++liblisp_a_SOURCES += lisp/setenv.c
+ endif
+
+ #
+diff --git a/lisp/env.c b/lisp/env.c
+deleted file mode 100644
+index e87793a..0000000
+--- a/lisp/env.c
++++ /dev/null
+@@ -1,151 +0,0 @@
+-/*
+- * Provide setenv() and unsetenv() on platforms that don't have them.
+- * From FreeBSD's libc.
+- */
+-
+-/*
+- * Copyright (c) 1987, 1993
+- * The Regents of the University of California. All rights reserved.
+- *
+- * Redistribution and use in source and binary forms, with or without
+- * modification, are permitted provided that the following conditions
+- * are met:
+- * 1. Redistributions of source code must retain the above copyright
+- * notice, this list of conditions and the following disclaimer.
+- * 2. Redistributions in binary form must reproduce the above copyright
+- * notice, this list of conditions and the following disclaimer in the
+- * documentation and/or other materials provided with the distribution.
+- * 3. All advertising materials mentioning features or use of this software
+- * must display the following acknowledgement:
+- * This product includes software developed by the University of
+- * California, Berkeley and its contributors.
+- * 4. Neither the name of the University nor the names of its contributors
+- * may be used to endorse or promote products derived from this software
+- * without specific prior written permission.
+- *
+- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+- * SUCH DAMAGE.
+- */
+-
+-/* $XFree86$ */
+-
+-
+-#include <stdlib.h>
+-#include <stddef.h>
+-#include <string.h>
+-
+-extern char **environ;
+-
+-extern int setenv(const char *name, const char *value, int overwrite);
+-extern void unsetenv(const char *name);
+-
+-static char *
+-findenv(const char *name, int *offset)
+-{
+- int len, i;
+- const char *np;
+- char **p, *cp;
+-
+- if (name == NULL || environ == NULL)
+- return NULL;
+-
+- for (np = name; *np && *np != '='; ++np)
+- continue;
+- len = np - name;
+- for (p = environ; (cp = *p) != NULL; ++p) {
+- for (np = name, i = len; i && *cp; i--)
+- if (*cp++ != *np++)
+- break;
+- if (i == 0 && *cp++ == '=') {
+- *offset = p - environ;
+- return cp;
+- }
+- }
+- return NULL;
+-}
+-
+-/*
+- * setenv --
+- * Set the value of the environmental variable "name" to be
+- * "value". If overwrite is set, replace any current value.
+- */
+-
+-int
+-setenv(const char *name, const char *value, int overwrite)
+-{
+- static char **alloced; /* if allocated space before */
+- char *c;
+- int l_value, offset;
+-
+- if (*value == '=') /* no '=' in value */
+- ++value;
+- l_value = strlen(value);
+- if ((c = findenv(name, &offset))) { /* find if already exists */
+- if (!overwrite)
+- return 0;
+- if (strlen(c) >= l_value) { /* old larger; copy over */
+- while ((*c++ = *value++))
+- ;
+- return 0;
+- }
+- } else { /* create new slot */
+- int cnt;
+- char **p;
+-
+- for (p = environ, cnt = 0; *p; ++p, ++cnt)
+- ;
+- if (alloced == environ) { /* just increase size */
+- p = (char **)realloc((char *)environ,
+- sizeof(char *) * (cnt + 2));
+- if (!p)
+- return -1;
+- alloced = environ = p;
+- } else { /* get new space */
+- /* copy old entries into it */
+- p = malloc(sizeof(char *) * (cnt + 2));
+- if (!p)
+- return -1;
+- memcpy(p, environ, cnt * sizeof(char *));
+- alloced = environ = p;
+- }
+- environ[cnt + 1] = NULL;
+- offset = cnt;
+- }
+- for (c = (char *)name; *c && *c != '='; ++c) /* no '=' in name */
+- ;
+- if (!(environ[offset] = /* name + '=' + value */
+- malloc((int)(c - name) + l_value + 2)))
+- return -1;
+- for (c = environ[offset]; (*c = *name++) && *c != '='; ++c)
+- ;
+- for (*c++ = '='; (*c++ = *value++); )
+- ;
+- return 0;
+-}
+-
+-/*
+- * unsetenv(name) --
+- * Delete environmental variable "name".
+- */
+-
+-void
+-unsetenv(const char *name)
+-{
+- char **p;
+- int offset;
+-
+- while (findenv(name, &offset)) /* if set multiple times */
+- for (p = &environ[offset];; ++p)
+- if (!(*p = *(p + 1)))
+- break;
+-}
+-
+diff --git a/lisp/getenv.c b/lisp/getenv.c
+new file mode 100644
+index 0000000..fd8482e
+--- /dev/null
++++ b/lisp/getenv.c
+@@ -0,0 +1,81 @@
++/* $OpenBSD: getenv.c,v 1.10 2010/08/23 22:31:50 millert Exp $ */
++/*
++ * Copyright (c) 1987, 1993
++ * The Regents of the University of California. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
++#include <stdlib.h>
++#include <string.h>
++
++char *__findenv(const char *name, int len, int *offset);
++
++/*
++ * __findenv --
++ * Returns pointer to value associated with name, if any, else NULL.
++ * Starts searching within the environmental array at offset.
++ * Sets offset to be the offset of the name/value combination in the
++ * environmental array, for use by putenv(3), setenv(3) and unsetenv(3).
++ * Explicitly removes '=' in argument name.
++ *
++ * This routine *should* be a static; don't use it.
++ */
++char *
++__findenv(const char *name, int len, int *offset)
++{
++ extern char **environ;
++ int i;
++ const char *np;
++ char **p, *cp;
++
++ if (name == NULL || environ == NULL)
++ return (NULL);
++ for (p = environ + *offset; (cp = *p) != NULL; ++p) {
++ for (np = name, i = len; i && *cp; i--)
++ if (*cp++ != *np++)
++ break;
++ if (i == 0 && *cp++ == '=') {
++ *offset = p - environ;
++ return (cp);
++ }
++ }
++ return (NULL);
++}
++
++/*
++ * getenv --
++ * Returns ptr to value associated with name, if any, else NULL.
++ */
++char *
++getenv(const char *name)
++{
++ int offset = 0;
++ const char *np;
++
++ for (np = name; *np && *np != '='; ++np)
++ ;
++ return (__findenv(name, (int)(np - name), &offset));
++}
+diff --git a/lisp/setenv.c b/lisp/setenv.c
+new file mode 100644
+index 0000000..089ab92
+--- /dev/null
++++ b/lisp/setenv.c
+@@ -0,0 +1,178 @@
++/* $OpenBSD: setenv.c,v 1.13 2010/08/23 22:31:50 millert Exp $ */
++/*
++ * Copyright (c) 1987 Regents of the University of California.
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
++#include <errno.h>
++#include <stdlib.h>
++#include <string.h>
++
++char *__findenv(const char *name, int len, int *offset);
++
++extern char **environ;
++static char **lastenv; /* last value of environ */
++
++/*
++ * putenv --
++ * Add a name=value string directly to the environmental, replacing
++ * any current value.
++ */
++int
++putenv(char *str)
++{
++ char **P, *cp;
++ size_t cnt;
++ int offset = 0;
++
++ for (cp = str; *cp && *cp != '='; ++cp)
++ ;
++ if (*cp != '=') {
++ errno = EINVAL;
++ return (-1); /* missing `=' in string */
++ }
++
++ if (__findenv(str, (int)(cp - str), &offset) != NULL) {
++ environ[offset++] = str;
++ /* could be set multiple times */
++ while (__findenv(str, (int)(cp - str), &offset)) {
++ for (P = &environ[offset];; ++P)
++ if (!(*P = *(P + 1)))
++ break;
++ }
++ return (0);
++ }
++
++ /* create new slot for string */
++ for (P = environ; *P != NULL; P++)
++ ;
++ cnt = P - environ;
++ P = (char **)realloc(lastenv, sizeof(char *) * (cnt + 2));
++ if (!P)
++ return (-1);
++ if (lastenv != environ)
++ memcpy(P, environ, cnt * sizeof(char *));
++ lastenv = environ = P;
++ environ[cnt] = str;
++ environ[cnt + 1] = NULL;
++ return (0);
++}
++
++/*
++ * setenv --
++ * Set the value of the environmental variable "name" to be
++ * "value". If rewrite is set, replace any current value.
++ */
++int
++setenv(const char *name, const char *value, int rewrite)
++{
++ char *C, **P;
++ const char *np;
++ int l_value, offset = 0;
++
++ for (np = name; *np && *np != '='; ++np)
++ ;
++#ifdef notyet
++ if (*np) {
++ errno = EINVAL;
++ return (-1); /* has `=' in name */
++ }
++#endif
++
++ l_value = strlen(value);
++ if ((C = __findenv(name, (int)(np - name), &offset)) != NULL) {
++ int tmpoff = offset + 1;
++ if (!rewrite)
++ return (0);
++#if 0 /* XXX - existing entry may not be writable */
++ if (strlen(C) >= l_value) { /* old larger; copy over */
++ while ((*C++ = *value++))
++ ;
++ return (0);
++ }
++#endif
++ /* could be set multiple times */
++ while (__findenv(name, (int)(np - name), &tmpoff)) {
++ for (P = &environ[tmpoff];; ++P)
++ if (!(*P = *(P + 1)))
++ break;
++ }
++ } else { /* create new slot */
++ size_t cnt;
++
++ for (P = environ; *P != NULL; P++)
++ ;
++ cnt = P - environ;
++ P = (char **)realloc(lastenv, sizeof(char *) * (cnt + 2));
++ if (!P)
++ return (-1);
++ if (lastenv != environ)
++ memcpy(P, environ, cnt * sizeof(char *));
++ lastenv = environ = P;
++ offset = cnt;
++ environ[cnt + 1] = NULL;
++ }
++ if (!(environ[offset] = /* name + `=' + value */
++ malloc((size_t)((int)(np - name) + l_value + 2))))
++ return (-1);
++ for (C = environ[offset]; (*C = *name++) && *C != '='; ++C)
++ ;
++ for (*C++ = '='; (*C++ = *value++); )
++ ;
++ return (0);
++}
++
++/*
++ * unsetenv(name) --
++ * Delete environmental variable "name".
++ */
++int
++unsetenv(const char *name)
++{
++ char **P;
++ const char *np;
++ int offset = 0;
++
++ if (!name || !*name) {
++ errno = EINVAL;
++ return (-1);
++ }
++ for (np = name; *np && *np != '='; ++np)
++ ;
++ if (*np) {
++ errno = EINVAL;
++ return (-1); /* has `=' in name */
++ }
++
++ /* could be set multiple times */
++ while (__findenv(name, (int)(np - name), &offset)) {
++ for (P = &environ[offset];; ++P)
++ if (!(*P = *(P + 1)))
++ break;
++ }
++ return (0);
++}
+diff --git a/realpath.c b/realpath.c
+index 4d58b75..21af4cf 100644
+--- a/realpath.c
++++ b/realpath.c
+@@ -1,9 +1,6 @@
++/* $OpenBSD: realpath.c,v 1.14 2011/07/24 21:03:00 miod Exp $ */
+ /*
+- * Copyright (c) 1994
+- * The Regents of the University of California. All rights reserved.
+- *
+- * This code is derived from software contributed to Berkeley by
+- * Jan-Simon Pendry.
++ * Copyright (c) 2003 Constantin S. Svintsoff <kostik at iclub.nsu.ru>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+@@ -13,18 +10,14 @@
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+- * 3. All advertising materials mentioning features or use of this software
+- * must display the following acknowledgement:
+- * This product includes software developed by the University of
+- * California, Berkeley and its contributors.
+- * 4. Neither the name of the University nor the names of its contributors
+- * may be used to endorse or promote products derived from this software
+- * without specific prior written permission.
++ * 3. The names of the authors may not be used to endorse or promote
++ * products derived from this software without specific prior written
++ * permission.
+ *
+- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+@@ -33,176 +26,187 @@
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+-/* $XFree86: xc/programs/xedit/realpath.c,v 1.4 2000/02/12 20:45:45 dawes Exp $ */
+-
+-#if defined(LIBC_SCCS) && !defined(lint)
+-static char sccsid[] = "@(#)realpath.c 8.1 (Berkeley) 2/16/94";
+-#endif /* LIBC_SCCS and not lint */
+
+ #include <sys/param.h>
+-#include <sys/types.h>
+ #include <sys/stat.h>
+
+ #include <errno.h>
+-#include <fcntl.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
+
+-#ifndef LISP
+-#include "xedit.h"
+-#endif
+-
+-#if defined(__Lynx__)
+-#define NO_FCHDIR
+-#endif
+-
+-#if defined(ISC)
+-#ifndef MAXPATHLEN
+-#define MAXPATHLEN 1024
+-#endif
+-#endif
+-#ifndef MAXSYMLINKS
+-#define MAXSYMLINKS 256
+-#endif
+-
+ /*
+- * char *realpath(const char *path, char resolved_path[MAXPATHLEN]);
++ * char *realpath(const char *path, char resolved[PATH_MAX]);
+ *
+ * Find the real name of path, by removing all ".", ".." and symlink
+ * components. Returns (resolved) on success, or (NULL) on failure,
+ * in which case the path which caused trouble is left in (resolved).
+ */
+ char *
+-realpath(path, resolved)
+- const char *path;
+- char *resolved;
++realpath(const char *path, char *resolved)
+ {
+ struct stat sb;
+-#ifdef NO_FCHDIR
+- char start[MAXPATHLEN];
+-#else
+- int fd;
+-#endif
+- int n, rootd, serrno;
+- char *p, *q, wbuf[MAXPATHLEN];
+- int symlinks = 0;
+-
+- /* Save the starting point. */
+-#ifdef NO_FCHDIR
+- if (getcwd(start, MAXPATHLEN) == NULL) {
+- (void)strcpy(resolved, ".");
+- return (NULL);
+- }
+-#else
+- if ((fd = open(".", O_RDONLY)) < 0) {
+- (void)strcpy(resolved, ".");
++ char *p, *q, *s;
++ size_t left_len, resolved_len;
++ unsigned symlinks;
++ int serrno, slen, mem_allocated;
++ char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX];
++
++ if (path[0] == '\0') {
++ errno = ENOENT;
+ return (NULL);
+ }
+-#endif
+
+- /*
+- * Find the dirname and basename from the path to be resolved.
+- * Change directory to the dirname component.
+- * lstat the basename part.
+- * if it is a symlink, read in the value and loop.
+- * if it is a directory, then change to that directory.
+- * get the current directory name and append the basename.
+- */
+- (void)strncpy(resolved, path, MAXPATHLEN - 1);
+- resolved[MAXPATHLEN - 1] = '\0';
+-loop:
+- q = strrchr(resolved, '/');
+- if (q != NULL) {
+- p = q + 1;
+- if (q == resolved)
+- q = "/";
+- else {
+- do {
+- --q;
+- } while (q > resolved && *q == '/');
+- q[1] = '\0';
+- q = resolved;
+- }
+- if (chdir(q) < 0)
+- goto err1;
+- } else
+- p = resolved;
++ serrno = errno;
+
+- /* Deal with the last component. */
+- if (*p != '\0' && lstat(p, &sb) == 0) {
+- if (S_ISLNK(sb.st_mode)) {
+- if (++symlinks > MAXSYMLINKS) {
+- errno = ELOOP;
+- goto err1;
+- }
+- n = readlink(p, resolved, MAXPATHLEN);
+- if (n < 0)
+- goto err1;
+- resolved[n] = '\0';
+- goto loop;
+- }
+- if (S_ISDIR(sb.st_mode)) {
+- if (chdir(p) < 0)
+- goto err1;
+- p = "";
++ if (resolved == NULL) {
++ resolved = malloc(PATH_MAX);
++ if (resolved == NULL)
++ return (NULL);
++ mem_allocated = 1;
++ } else
++ mem_allocated = 0;
++
++ symlinks = 0;
++ if (path[0] == '/') {
++ resolved[0] = '/';
++ resolved[1] = '\0';
++ if (path[1] == '\0')
++ return (resolved);
++ resolved_len = 1;
++ left_len = strlcpy(left, path + 1, sizeof(left));
++ } else {
++ if (getcwd(resolved, PATH_MAX) == NULL) {
++ if (mem_allocated)
++ free(resolved);
++ else
++ strlcpy(resolved, ".", PATH_MAX);
++ return (NULL);
+ }
++ resolved_len = strlen(resolved);
++ left_len = strlcpy(left, path, sizeof(left));
++ }
++ if (left_len >= sizeof(left) || resolved_len >= PATH_MAX) {
++ errno = ENAMETOOLONG;
++ goto err;
+ }
+
+ /*
+- * Save the last component name and get the full pathname of
+- * the current directory.
+- */
+- (void)strcpy(wbuf, p);
+- if (getcwd(resolved, MAXPATHLEN) == 0)
+- goto err1;
+-
+- /*
+- * Join the two strings together, ensuring that the right thing
+- * happens if the last component is empty, or the dirname is root.
++ * Iterate over path components in `left'.
+ */
+- if (resolved[0] == '/' && resolved[1] == '\0')
+- rootd = 1;
+- else
+- rootd = 0;
+-
+- if (*wbuf) {
+- if (strlen(resolved) + strlen(wbuf) + rootd + 1 > MAXPATHLEN) {
++ while (left_len != 0) {
++ /*
++ * Extract the next path component and adjust `left'
++ * and its length.
++ */
++ p = strchr(left, '/');
++ s = p ? p : left + left_len;
++ if (s - left >= sizeof(next_token)) {
+ errno = ENAMETOOLONG;
+- goto err1;
++ goto err;
++ }
++ memcpy(next_token, left, s - left);
++ next_token[s - left] = '\0';
++ left_len -= s - left;
++ if (p != NULL)
++ memmove(left, s + 1, left_len + 1);
++ if (resolved[resolved_len - 1] != '/') {
++ if (resolved_len + 1 >= PATH_MAX) {
++ errno = ENAMETOOLONG;
++ goto err;
++ }
++ resolved[resolved_len++] = '/';
++ resolved[resolved_len] = '\0';
++ }
++ if (next_token[0] == '\0')
++ continue;
++ else if (strcmp(next_token, ".") == 0)
++ continue;
++ else if (strcmp(next_token, "..") == 0) {
++ /*
++ * Strip the last path component except when we have
++ * single "/"
++ */
++ if (resolved_len > 1) {
++ resolved[resolved_len - 1] = '\0';
++ q = strrchr(resolved, '/') + 1;
++ *q = '\0';
++ resolved_len = q - resolved;
++ }
++ continue;
+ }
+- if (rootd == 0)
+- (void)strcat(resolved, "/");
+- (void)strcat(resolved, wbuf);
+- }
+
+- /* Go back to where we came from. */
+-#ifdef NO_FCHDIR
+- if (chdir(start) < 0)
+-#else
+- if (fchdir(fd) < 0)
+-#endif
+- {
+- serrno = errno;
+- goto err2;
++ /*
++ * Append the next path component and lstat() it. If
++ * lstat() fails we still can return successfully if
++ * there are no more path components left.
++ */
++ resolved_len = strlcat(resolved, next_token, PATH_MAX);
++ if (resolved_len >= PATH_MAX) {
++ errno = ENAMETOOLONG;
++ goto err;
++ }
++ if (lstat(resolved, &sb) != 0) {
++ if (errno == ENOENT && p == NULL) {
++ errno = serrno;
++ return (resolved);
++ }
++ goto err;
++ }
++ if (S_ISLNK(sb.st_mode)) {
++ if (symlinks++ > MAXSYMLINKS) {
++ errno = ELOOP;
++ goto err;
++ }
++ slen = readlink(resolved, symlink, sizeof(symlink) - 1);
++ if (slen < 0)
++ goto err;
++ symlink[slen] = '\0';
++ if (symlink[0] == '/') {
++ resolved[1] = 0;
++ resolved_len = 1;
++ } else if (resolved_len > 1) {
++ /* Strip the last path component. */
++ resolved[resolved_len - 1] = '\0';
++ q = strrchr(resolved, '/') + 1;
++ *q = '\0';
++ resolved_len = q - resolved;
++ }
++
++ /*
++ * If there are any path components left, then
++ * append them to symlink. The result is placed
++ * in `left'.
++ */
++ if (p != NULL) {
++ if (symlink[slen - 1] != '/') {
++ if (slen + 1 >= sizeof(symlink)) {
++ errno = ENAMETOOLONG;
++ goto err;
++ }
++ symlink[slen] = '/';
++ symlink[slen + 1] = 0;
++ }
++ left_len = strlcat(symlink, left, sizeof(left));
++ if (left_len >= sizeof(left)) {
++ errno = ENAMETOOLONG;
++ goto err;
++ }
++ }
++ left_len = strlcpy(left, symlink, sizeof(left));
++ }
+ }
+
+- /* It's okay if the close fails, what's an fd more or less? */
+-#ifndef NO_FCHDIR
+- (void)close(fd);
+-#endif
++ /*
++ * Remove trailing slash except when the resolved pathname
++ * is a single "/".
++ */
++ if (resolved_len > 1 && resolved[resolved_len - 1] == '/')
++ resolved[resolved_len - 1] = '\0';
+ return (resolved);
+
+-err1: serrno = errno;
+-#ifdef NO_FCHDIR
+- (void)chdir(start);
+-#else
+- (void)fchdir(fd);
+-#endif
+-err2:
+-#ifndef NO_FCHDIR
+- (void)close(fd);
+-#endif
+- errno = serrno;
++err:
++ if (mem_allocated)
++ free(resolved);
+ return (NULL);
+ }
+--
+1.7.9.2
+
diff --git a/0002-Correct-64-bit-overflow-check-and-bignum-code.patch b/0002-Correct-64-bit-overflow-check-and-bignum-code.patch
new file mode 100644
index 0000000..f2243b9
--- /dev/null
+++ b/0002-Correct-64-bit-overflow-check-and-bignum-code.patch
@@ -0,0 +1,216 @@
+From 6a7d36535dc8fbe6f258ab9df849d96196f00ce9 Mon Sep 17 00:00:00 2001
+From: pcpa <paulo.cesar.pereira.de.andrade at gmail.com>
+Date: Thu, 24 May 2012 15:26:50 -0300
+Subject: [PATCH 2/4] Correct 64 bit overflow check and bignum code.
+
+Signed-off-by: pcpa <paulo.cesar.pereira.de.andrade at gmail.com>
+---
+ lisp/mathimp.c | 35 +++--------------------------------
+ lisp/mp/mp.c | 12 ++++++------
+ lisp/mp/mp.h | 2 ++
+ lisp/mp/mpi.c | 8 ++++----
+ lisp/read.c | 4 +---
+ 5 files changed, 16 insertions(+), 45 deletions(-)
+
+diff --git a/lisp/mathimp.c b/lisp/mathimp.c
+index f5c098f..293625b 100644
+--- a/lisp/mathimp.c
++++ b/lisp/mathimp.c
+@@ -39,15 +39,6 @@
+ #define CONST /**/
+ #endif
+
+-/* mask for checking overflow on long operations */
+-#ifdef LONG64
+-#define FI_MASK 0x4000000000000000L
+-#define LONGSBITS 63
+-#else
+-#define FI_MASK 0x40000000L
+-#define LONGSBITS 31
+-#endif
+-
+ #define N_FIXNUM 1
+ #define N_BIGNUM 2
+ #define N_FLONUM 3
+@@ -2738,7 +2729,7 @@ fi_fi_add_overflow(long op1, long op2)
+ {
+ long op = op1 + op2;
+
+- return (op1 > 0 ? op2 > op : op2 < op);
++ return (op2 >= 0 ? op < op1 : op > op1);
+ }
+
+ /*
+@@ -2749,7 +2740,7 @@ fi_fi_sub_overflow(long op1, long op2)
+ {
+ long op = op1 - op2;
+
+- return (((op1 < 0) ^ (op2 < 0)) && ((op < 0) ^ (op1 < 0)));
++ return (op2 >= 0 ? op > op1 : op < op1);
+ }
+
+ /*
+@@ -2758,35 +2749,15 @@ fi_fi_sub_overflow(long op1, long op2)
+ static INLINE int
+ fi_fi_mul_overflow(long op1, long op2)
+ {
+-#ifndef LONG64
+- double op = (double)op1 * (double)op2;
+-
+- return (op > 2147483647.0 || op < -2147483648.0);
+-#else
+- int shift;
+- long mask;
+-
+ if (op1 == 0 || op1 == 1 || op2 == 0 || op2 == 1)
+ return (0);
+-
+ if (op1 == MINSLONG || op2 == MINSLONG)
+ return (1);
+-
+ if (op1 < 0)
+ op1 = -op1;
+ if (op2 < 0)
+ op2 = -op2;
+-
+- for (shift = 0, mask = FI_MASK; shift < LONGSBITS; shift++, mask >>= 1)
+- if (op1 & mask)
+- break;
+- ++shift;
+- for (mask = FI_MASK; shift < LONGSBITS; shift++, mask >>= 1)
+- if (op2 & mask)
+- break;
+-
+- return (shift < LONGSBITS);
+-#endif
++ return (op1 > MAXSLONG / op2);
+ }
+
+
+diff --git a/lisp/mp/mp.c b/lisp/mp/mp.c
+index 2afb343..cf24768 100644
+--- a/lisp/mp/mp.c
++++ b/lisp/mp/mp.c
+@@ -190,19 +190,19 @@ mp_add(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2)
+ MP_SWAP(op1, op2, len1, len2);
+
+ /* unroll start of loop */
+- value = op1[0] + op2[0];
++ value = (BNI)op1[0] + op2[0];
+ rop[0] = value;
+ carry = value >> BNSBITS;
+
+ /* add op1 and op2 */
+ for (size = 1; size < len2; size++) {
+- value = op1[size] + op2[size] + carry;
++ value = (BNI)op1[size] + op2[size] + carry;
+ rop[size] = value;
+ carry = value >> BNSBITS;
+ }
+ if (rop != op1) {
+ for (; size < len1; size++) {
+- value = op1[size] + carry;
++ value = (BNI)op1[size] + carry;
+ rop[size] = value;
+ carry = value >> BNSBITS;
+ }
+@@ -210,7 +210,7 @@ mp_add(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2)
+ else {
+ /* if rop == op1, than just adjust carry */
+ for (; carry && size < len1; size++) {
+- value = op1[size] + carry;
++ value = (BNI)op1[size] + carry;
+ rop[size] = value;
+ carry = value >> BNSBITS;
+ }
+@@ -237,7 +237,7 @@ mp_sub(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2)
+ }
+
+ /* unroll start of loop */
+- svalue = op1[0] - op2[0];
++ svalue = (long)op1[0] - op2[0];
+ rop[0] = svalue;
+ carry = svalue < 0;
+
+@@ -257,7 +257,7 @@ mp_sub(BNS *rop, BNS *op1, BNS *op2, BNI len1, BNI len2)
+ else {
+ /* if rop == op1, than just adjust carry */
+ for (; carry && size < len1; size++) {
+- svalue = op1[size] - carry;
++ svalue = (long)op1[size] - carry;
+ rop[size] = svalue;
+ carry = svalue < 0;
+ }
+diff --git a/lisp/mp/mp.h b/lisp/mp/mp.h
+index 8bcb127..c5a74f3 100644
+--- a/lisp/mp/mp.h
++++ b/lisp/mp/mp.h
+@@ -76,6 +76,7 @@
+ # define BNI unsigned long
+ # define BNS unsigned int
+ # define MINSLONG 0x8000000000000000UL
++# define MAXSLONG 0x7fffffffffffffffUL
+ # define CARRY 0x100000000
+ # define LMASK 0xffffffff00000000UL
+ # define SMASK 0x00000000ffffffffUL
+@@ -89,6 +90,7 @@
+ # define BNI unsigned long
+ # define BNS unsigned short
+ # define MINSLONG 0x80000000UL
++# define MAXSLONG 0x7fffffffUL
+ # define CARRY 0x10000
+ # define LMASK 0xffff0000UL
+ # define SMASK 0x0000ffffUL
+diff --git a/lisp/mp/mpi.c b/lisp/mp/mpi.c
+index fabe366..447bd23 100644
+--- a/lisp/mp/mpi.c
++++ b/lisp/mp/mpi.c
+@@ -318,7 +318,7 @@ mpi_setstr(mpi *rop, char *str, int base)
+ if (islower(value))
+ value = toupper(value);
+ value = value > '9' ? value - 'A' + 10 : value - '0';
+- value += rop->digs[0] * base;
++ value += (BNI)rop->digs[0] * base;
+ carry = value >> BNSBITS;
+ rop->digs[0] = (BNS)value;
+ for (i = 1; i < size; i++) {
+@@ -642,10 +642,10 @@ mpi_divqr(mpi *qrop, mpi *rrop, mpi *num, mpi *den)
+ if (ndigs[npos] == ddigs[dpos])
+ qest = (BNS)SMASK;
+ else
+- qest = (BNS)((((BNI)(ndigs[npos]) << 16) + ndigs[npos - 1]) /
++ qest = (BNS)((((BNI)(ndigs[npos]) << BNSBITS) + ndigs[npos - 1]) /
+ ddigs[dpos]);
+
+- while ((value = ((BNI)(ndigs[npos]) << 16) + ndigs[npos - 1] -
++ while ((value = ((BNI)(ndigs[npos]) << BNSBITS) + ndigs[npos - 1] -
+ qest * (BNI)(ddigs[dpos])) < CARRY &&
+ ddigs[dpos - 1] * (BNI)qest >
+ (value << BNSBITS) + ndigs[npos - 2])
+@@ -1603,7 +1603,7 @@ mpi_getstr(char *str, mpi *op, int base)
+
+ /* make copy of op data and adjust digs */
+ xdigs = mp_malloc(size * sizeof(BNS));
+- memcpy(xdigs, op->digs, size * sizeof(unsigned short));
++ memcpy(xdigs, op->digs, size * sizeof(BNS));
+ digs = xdigs + size - 1;
+
+ /* convert to string */
+diff --git a/lisp/read.c b/lisp/read.c
+index 9c70b64..a49e240 100644
+--- a/lisp/read.c
++++ b/lisp/read.c
+@@ -1474,9 +1474,7 @@ LispParseNumber(char *str, int radix, LispObj *read__stream, int read__line)
+ integer = strtol(str, NULL, radix);
+
+ /* if does not fit in a long */
+- if (errno == ERANGE &&
+- ((*str == '-' && integer == LONG_MIN) ||
+- (*str != '-' && integer == LONG_MAX))) {
++ if (errno == ERANGE) {
+ bignum = LispMalloc(sizeof(mpi));
+ mpi_init(bignum);
+ mpi_setstr(bignum, str, radix);
+--
+1.7.9.2
+
diff --git a/0003-Use-proper-pointer-when-computing-realpath-of-a-new-.patch b/0003-Use-proper-pointer-when-computing-realpath-of-a-new-.patch
new file mode 100644
index 0000000..83fb2dc
--- /dev/null
+++ b/0003-Use-proper-pointer-when-computing-realpath-of-a-new-.patch
@@ -0,0 +1,30 @@
+From 039cfd19ce806e43a3459edd1789c142607e9381 Mon Sep 17 00:00:00 2001
+From: pcpa <paulo.cesar.pereira.de.andrade at gmail.com>
+Date: Thu, 24 May 2012 15:29:01 -0300
+Subject: [PATCH 3/4] Use proper pointer when computing "realpath" of a new
+ file.
+
+ In some special conditions it previously could omit a slash, and
+instead of creating foo/bar/baz would create foo/barbaz.
+
+Signed-off-by: pcpa <paulo.cesar.pereira.de.andrade at gmail.com>
+---
+ util.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/util.c b/util.c
+index f65bf4d..2378b40 100644
+--- a/util.c
++++ b/util.c
+@@ -522,7 +522,7 @@ ResolveName(char *filename)
+ int length = strlen(result);
+
+ XmuSnprintf(result + length, BUFSIZ - length, "%s%s",
+- dir[length - 1] == '/' ? "" : "/", file);
++ result[length - 1] == '/' ? "" : "/", file);
+ }
+
+ XtFree(tmp);
+--
+1.7.9.2
+
diff --git a/0004-Avoid-problems-with-builds-with-Werror-format-securi.patch b/0004-Avoid-problems-with-builds-with-Werror-format-securi.patch
new file mode 100644
index 0000000..bbbc7e6
--- /dev/null
+++ b/0004-Avoid-problems-with-builds-with-Werror-format-securi.patch
@@ -0,0 +1,41 @@
+From 8a92fdea98602f267fb5441eb9f9fb7a6ecc0d21 Mon Sep 17 00:00:00 2001
+From: pcpa <paulo.cesar.pereira.de.andrade at gmail.com>
+Date: Thu, 24 May 2012 15:33:14 -0300
+Subject: [PATCH 4/4] Avoid problems with builds with
+ -Werror=format-security.
+
+Signed-off-by: pcpa <paulo.cesar.pereira.de.andrade at gmail.com>
+---
+ lisp/lisp.c | 2 +-
+ lisp/mathimp.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lisp/lisp.c b/lisp/lisp.c
+index 4b393c1..206c038 100644
+--- a/lisp/lisp.c
++++ b/lisp/lisp.c
+@@ -5044,7 +5044,7 @@ LispSignal(int signum)
+ errstr = buffer;
+ break;
+ }
+- LispDestroy(errstr);
++ LispDestroy("%s", errstr);
+ }
+
+ void
+diff --git a/lisp/mathimp.c b/lisp/mathimp.c
+index 293625b..5f8bd4d 100644
+--- a/lisp/mathimp.c
++++ b/lisp/mathimp.c
+@@ -460,7 +460,7 @@ static char *fatal_object_error_strings[] = {
+ static void
+ fatal_error(int num)
+ {
+- LispDestroy(fatal_error_strings[num]);
++ LispDestroy("%s", fatal_error_strings[num]);
+ }
+
+ static void
+--
+1.7.9.2
+
diff --git a/sources b/sources
index e69de29..62308f8 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+f55e84713542a36887e966fc0648dd7b xedit-1.2.0.tar.bz2
diff --git a/xedit.desktop b/xedit.desktop
new file mode 100644
index 0000000..867bad2
--- /dev/null
+++ b/xedit.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Name=Xedit
+GenericName=Text Editor
+Comment=Simple text editor for X
+Exec=xedit %f
+Terminal=false
+Type=Application
+Categories=Utility;TextEditor;
diff --git a/xedit.spec b/xedit.spec
new file mode 100644
index 0000000..64468e6
--- /dev/null
+++ b/xedit.spec
@@ -0,0 +1,70 @@
+Name: xedit
+Version: 1.2.0
+Release: 3%{?dist}
+Summary: Simple text editor for X
+Group: Applications/Editors
+URL: http://xorg.freedesktop.org
+Source0: http://xorg.freedesktop.org/releases/individual/app/%{name}-%{version}.tar.bz2
+Source1: %{name}.desktop
+License: MIT and BSD
+BuildRequires: desktop-file-utils
+BuildRequires: libXaw-devel
+BuildRequires: xorg-x11-util-macros
+Requires: xorg-x11-xbitmaps
+Requires: aspell
+Requires: aspell-en
+Requires: grep
+Requires: words
+Requires: ctags
+Requires: xorg-x11-fonts-misc
+Requires: xorg-x11-fonts-75dpi
+Requires: xorg-x11-fonts-100dpi
+# Submited upstream https://bugs.freedesktop.org/show_bug.cgi?id=50320
+Patch0: 0001-Update-fallback-implementation-of-missing-libc-funct.patch
+Patch1: 0002-Correct-64-bit-overflow-check-and-bignum-code.patch
+Patch2: 0003-Use-proper-pointer-when-computing-realpath-of-a-new-.patch
+Patch3: 0004-Avoid-problems-with-builds-with-Werror-format-securi.patch
+
+%description
+Xedit provides a simple text editor for X.
+
+%prep
+%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+
+%build
+%configure --with-lispdir=%{_datadir}/X11/%{name}
+
+%install
+make install DESTDIR=${RPM_BUILD_ROOT} INSTALL="install -p"
+install -D -m 644 %{SOURCE1} ${RPM_BUILD_ROOT}%{_datadir}/applications/%{name}.desktop
+desktop-file-validate ${RPM_BUILD_ROOT}%{_datadir}/applications/%{name}.desktop
+
+%check
+make check
+
+%files
+%doc AUTHORS ChangeLog COPYING README
+%{_bindir}/%{name}
+%{_datadir}/X11/%{name}
+%{_datadir}/X11/app-defaults/Xedit
+%{_datadir}/X11/app-defaults/Xedit-color
+%{_datadir}/applications/%{name}.desktop
+%{_mandir}/man1/xedit.1*
+
+%changelog
+* Sat May 26 2012 pcpa <paulo.cesar.pereira.de.andrade at gmail.com> - 1.2.0-2
+- Patch package to not have BSD 4 clause files.
+- Write patch to correct 64 bit overflow tests in a compatible license.
+- Update extra patches to use the ones submitted upstream.
+
+* Mon May 21 2012 pcpa <paulo.cesar.pereira.de.andrade at gmail.com> - 1.2.0-1
+- Add proper documentation to package.
+- Update to latest upstream release.
+- Remove patches already in upstream.
+
+* Mon Apr 23 2012 pcpa <paulo.cesar.pereira.de.andrade at gmail.com> - 1.1.2-1
+- Initial xedit spec.
More information about the scm-commits
mailing list