summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBas Couwenberg <sebastic@debian.org>2018-07-31 14:13:20 +0200
committerBas Couwenberg <sebastic@debian.org>2018-07-31 14:13:20 +0200
commit07e88db6a030fa9c50124d55388f504661e1d149 (patch)
treed7210a54b1490953bb8941d6f1c966ac2ee4139a
Import fyba_4.1.1-5.debian.tar.xz
[dgit import tarball fyba 4.1.1-5 fyba_4.1.1-5.debian.tar.xz]
-rw-r--r--changelog58
-rw-r--r--compat1
-rw-r--r--control33
-rw-r--r--copyright45
-rw-r--r--gbp.conf3
-rw-r--r--libfyba-dev.doc-base12
-rw-r--r--libfyba-dev.docs2
-rw-r--r--libfyba-dev.install4
-rw-r--r--libfyba0.docs1
-rw-r--r--libfyba0.install1
-rw-r--r--libfyba0.lintian-overrides3
-rw-r--r--patches/01_noexit_in_library.patch349
-rw-r--r--patches/02_fix_linking.patch34
-rw-r--r--patches/fix_issue.patch859
-rw-r--r--patches/series3
-rwxr-xr-xrules17
-rw-r--r--shlibs3
-rw-r--r--source/format1
-rw-r--r--source/lintian-overrides3
-rw-r--r--upstream/metadata6
-rw-r--r--watch7
21 files changed, 1445 insertions, 0 deletions
diff --git a/changelog b/changelog
new file mode 100644
index 0000000..4b87cc7
--- /dev/null
+++ b/changelog
@@ -0,0 +1,58 @@
+fyba (4.1.1-5) unstable; urgency=medium
+
+ * Team upload.
+ * Drop autopkgtest to test installability.
+ (closes: #905117)
+ * Add lintian override for testsuite-autopkgtest-missing.
+
+ -- Bas Couwenberg <sebastic@debian.org> Tue, 31 Jul 2018 14:13:20 +0200
+
+fyba (4.1.1-4) unstable; urgency=medium
+
+ * Team upload.
+ * Change Maintainer to Debian GIS project, move Ruben to Uploaders.
+ * Restructure control file with cme.
+ * Drop autoconf & libtool build dependencies, pulled in via dh-autoreconf.
+ * Update watch file to handle common issues.
+ * Drop incorrect Forwarded header from patches.
+ * Add upstream metadata.
+ * Bump Standards-Version to 4.1.5, no changes.
+ * Strip trailing whitespace from control file.
+ * Update copyright-format URL to use HTTPS.
+ * Update Vcs-* URLs for Salsa.
+ * Don't use autotools-dev explicitly.
+ * Drop obsolete dbg package.
+ * Add autopkgtest to test installability.
+ * Enable all hardening buildflags.
+ * Don't limit dh_strip to libfyba0.
+ * Override dh_makeshlibs to use -V.
+ * Fix capitalization error in description synopsis.
+
+ -- Bas Couwenberg <sebastic@debian.org> Sun, 29 Jul 2018 21:10:50 +0200
+
+fyba (4.1.1-3) unstable; urgency=medium
+
+ * debian/control:
+ - Set Vcs URLs to https
+ - Updated standards to 3.9.8 (no changes)
+ * debian/patches/fix_issue.patch
+ - Don't define min/max macros
+ Fixes FTBFS with GCC 6 (Closes: #831206)
+
+ -- Ruben Undheim <ruben.undheim@gmail.com> Fri, 19 Aug 2016 17:59:12 +0000
+
+fyba (4.1.1-2) unstable; urgency=low
+
+ * debian/control:
+ - Fixed debhelper version 9.0.0 -> 9
+ - Set "Multi-Arch: same" to enable multiarch for library
+ - Standards version to 3.9.6
+ * Added debian/gbp.conf to automatically enable pristine-tar build
+
+ -- Ruben Undheim <ruben.undheim@gmail.com> Sat, 23 May 2015 12:20:40 +0200
+
+fyba (4.1.1-1) unstable; urgency=low
+
+ * Initial release (Closes: #760544)
+
+ -- Ruben Undheim <ruben.undheim@gmail.com> Thu, 04 Sep 2014 21:41:19 +0200
diff --git a/compat b/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/compat
@@ -0,0 +1 @@
+9
diff --git a/control b/control
new file mode 100644
index 0000000..d1c192b
--- /dev/null
+++ b/control
@@ -0,0 +1,33 @@
+Source: fyba
+Maintainer: Debian GIS Project <pkg-grass-devel@lists.alioth.debian.org>
+Uploaders: Ruben Undheim <ruben.undheim@gmail.com>
+Section: libs
+Priority: optional
+Build-Depends: debhelper (>= 9.20160114),
+ dh-autoreconf
+Standards-Version: 4.1.5
+Vcs-Browser: https://salsa.debian.org/debian-gis-team/fyba
+Vcs-Git: https://salsa.debian.org/debian-gis-team/fyba.git
+Homepage: https://github.com/kartverket/fyba
+
+Package: libfyba0
+Architecture: any
+Multi-Arch: same
+Depends: ${shlibs:Depends},
+ ${misc:Depends}
+Pre-Depends: ${misc:Pre-Depends}
+Description: FYBA library to read and write Norwegian geodata standard format SOSI
+ OpenFYBA is the source code release of the FYBA library, distributed by the
+ National Mapping Authority of Norway (Statens kartverk) to read and write
+ files in the National geodata standard format SOSI.
+
+Package: libfyba-dev
+Architecture: any
+Multi-Arch: same
+Section: libdevel
+Depends: libfyba0 (= ${binary:Version}),
+ ${misc:Depends}
+Description: Header files for FYBA library
+ This is the development package for developing applications that depends on
+ libfyba. It includes header files, static library files and HTML
+ documentation.
diff --git a/copyright b/copyright
new file mode 100644
index 0000000..9cd76a0
--- /dev/null
+++ b/copyright
@@ -0,0 +1,45 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: fyba
+Source: https://github.com/kartverket/fyba/
+
+Files: *
+Copyright: 1990-2011 Statens kartverk
+License: MIT
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Files: debian/*
+Copyright: 2013 Anders Einar Hilden <hildenae@gmail.com>
+ 2014 Ruben Undheim <ruben.undheim@gmail.com>
+License: GPL-2.0+
+ This package 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.
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
+
diff --git a/gbp.conf b/gbp.conf
new file mode 100644
index 0000000..cdeff4c
--- /dev/null
+++ b/gbp.conf
@@ -0,0 +1,3 @@
+[DEFAULT]
+pristine-tar = True
+upstream-tag=%(version)s
diff --git a/libfyba-dev.doc-base b/libfyba-dev.doc-base
new file mode 100644
index 0000000..79abd50
--- /dev/null
+++ b/libfyba-dev.doc-base
@@ -0,0 +1,12 @@
+Document: libfyba-dev
+Title: libfyba API documentation
+Abstract: library for reading SOSI files
+ This library lets you open and manipulate SOSI files. The
+ library was released by the Norwegian Mapping Authority.
+ .
+ This document describes the API of the library.
+Section: Programming/C
+
+Format: HTML
+Index: /usr/share/doc/libfyba-dev/en_EN/fyba.html
+Files: /usr/share/doc/libfyba-dev/en_EN/fyba*.html
diff --git a/libfyba-dev.docs b/libfyba-dev.docs
new file mode 100644
index 0000000..fb0cb8d
--- /dev/null
+++ b/libfyba-dev.docs
@@ -0,0 +1,2 @@
+README
+doc/en_EN
diff --git a/libfyba-dev.install b/libfyba-dev.install
new file mode 100644
index 0000000..76f28fa
--- /dev/null
+++ b/libfyba-dev.install
@@ -0,0 +1,4 @@
+usr/include/*
+usr/lib/*/lib*.a
+usr/lib/*/lib*.so
+usr/lib/*/pkgconfig/*
diff --git a/libfyba0.docs b/libfyba0.docs
new file mode 100644
index 0000000..e845566
--- /dev/null
+++ b/libfyba0.docs
@@ -0,0 +1 @@
+README
diff --git a/libfyba0.install b/libfyba0.install
new file mode 100644
index 0000000..3ddde58
--- /dev/null
+++ b/libfyba0.install
@@ -0,0 +1 @@
+usr/lib/*/lib*.so.*
diff --git a/libfyba0.lintian-overrides b/libfyba0.lintian-overrides
new file mode 100644
index 0000000..4f024df
--- /dev/null
+++ b/libfyba0.lintian-overrides
@@ -0,0 +1,3 @@
+# Symbols are problematic for C++ libraries, shlibs is used instead.
+no-symbols-control-file *
+
diff --git a/patches/01_noexit_in_library.patch b/patches/01_noexit_in_library.patch
new file mode 100644
index 0000000..39a35ab
--- /dev/null
+++ b/patches/01_noexit_in_library.patch
@@ -0,0 +1,349 @@
+Description: This fixes the shlib-calls-exit lintian. Every
+ exit()-call is replaced with an error message and return.
+Author: Ruben Undheim <ruben.undheim@gmail.com>
+
+--- a/src/FYBA/FYLB.cpp
++++ b/src/FYBA/FYLB.cpp
+@@ -3280,7 +3280,8 @@ short LB_RGru(LC_FILADM *pFil,UT_INT64 s
+ UT_SNPRINTF(err().tx,LC_ERR_LEN," \"%s %s\"",LN_GetNavn(&(pAktFil->SosiNavn),
+ pLb->cur_navn[pLb->cur_niv-1]),pLb->pp);
+ LC_Error(47,"(LB_RGru)",err().tx);
+- exit (2);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+
+ siste = 0;
+@@ -4275,7 +4276,8 @@ void LB_FyllBuffer (FILE *fil,LB_LESEBUF
+ } else {
+ LC_Error(43,"(LB_FyllBuffer)",""); /* Annen lesefeil */
+ }
+- exit(1);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return;
+ }
+
+ /* Konverter til rett tegnsett */
+@@ -4286,7 +4288,8 @@ void LB_FyllBuffer (FILE *fil,LB_LESEBUF
+ char szMelding[LC_MAX_SOSI_LINJE_LEN + 10];
+ UT_SNPRINTF(szMelding, LC_MAX_SOSI_LINJE_LEN + 10, "\"%s\"", plb->tx);
+ LC_Error(164,"(LB_FyllBuffer)",szMelding);
+- exit(1);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return;
+ }
+
+ /* Nullstill pekere */
+--- a/src/FYBA/FYLI.cpp
++++ b/src/FYBA/FYLI.cpp
+@@ -151,7 +151,8 @@ short LI_OpenInit(LC_FILADM *pFil)
+ if (fil[strlen(fil)-1] == ' ')
+ {
+ LC_Error(120,"(LI_OpenInit)",pFil->pszNavn);
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+
+ // Opprett katalogen
+@@ -173,7 +174,8 @@ short LI_OpenInit(LC_FILADM *pFil)
+
+ if (fwrite(pFil,sizeof(*pFil),1,pF) != 1) {
+ LC_Error(112,"(LI_OpenInit)","");
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+
+ fclose(pF);
+@@ -260,7 +262,8 @@ short LI_OpenRead(LC_FILADM *pFil)
+ if (fread(pGrt,sizeof(*pGrt),1,pF) != 1) { /* Les */
+ UT_SNPRINTF(err().tx,LC_ERR_LEN," %s : %ld",pFil->pszNavn,linje);
+ LC_Error(111,"(LI_OpenRead): ",err().tx);
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+ }
+ fclose(pF);
+@@ -275,7 +278,8 @@ short LI_OpenRead(LC_FILADM *pFil)
+ if (! feof(pF)) {
+ UT_SNPRINTF(err().tx,LC_ERR_LEN," %ld",lSnr);
+ LC_Error(111,"(LI_OpenRead): ",err().tx);
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+ fclose(pF);
+
+@@ -286,7 +290,8 @@ short LI_OpenRead(LC_FILADM *pFil)
+ if (fread(&bt,sizeof(bt),1,pF) != 1) { /* Les */
+ UT_SNPRINTF(err().tx,LC_ERR_LEN," %s : %ld",pFil->pszNavn,linje);
+ LC_Error(111,"(LI_OpenRead): ",err().tx);
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+ LI_PutBt(pFil,linje,bt);
+ }
+@@ -298,7 +303,8 @@ short LI_OpenRead(LC_FILADM *pFil)
+ if (fread(&Boks,sizeof(Boks),1,pF) != 1) { /* Les */
+ UT_SNPRINTF(err().tx,LC_ERR_LEN," %s : %ld",pFil->pszNavn,linje);
+ LC_Error(111,"(LI_OpenRead): ",err().tx);
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+
+ if (Boks.dMaxAust != (double)LONG_MAX) {
+@@ -440,7 +446,8 @@ void LI_Close(LC_FILADM *pFil,short s_st
+ for (lGrNr=0; lGrNr<pFil->lAntGr; lGrNr++) {
+ if (fwrite(LI_GetGrt(pFil,lGrNr),sizeof (LC_GRTAB_LINJE),1,pF) != 1) {
+ LC_Error(112,"(LI_Close)","");
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return;
+ }
+ }
+ fclose(pF);
+@@ -451,7 +458,8 @@ void LI_Close(LC_FILADM *pFil,short s_st
+ flag = LI_GetBt(pFil,lGrNr);
+ if (fwrite(&flag,sizeof flag,1,pF) != 1) {
+ LC_Error(112,"(LI_Close)","");
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return;
+ }
+ }
+ fclose(pF);
+@@ -462,7 +470,8 @@ void LI_Close(LC_FILADM *pFil,short s_st
+ lGrNr = LI_GetSnr(pFil,lSnr);
+ if (fwrite(&lGrNr,sizeof lGrNr,1,pF) != 1) {
+ LC_Error(112,"(LI_Close)","");
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return;
+ }
+ }
+ fclose(pF);
+@@ -476,13 +485,15 @@ void LI_Close(LC_FILADM *pFil,short s_st
+ Boks.dMaxAust = (double)LONG_MAX;
+ if (fwrite(&Boks,sizeof (LC_BOKS),1,pF) != 1) {
+ LC_Error(112,"(LI_Close)","");
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return;
+ }
+
+ } else {
+ if (fwrite(&(pRL->Boks),sizeof (LC_BOKS),1,pF) != 1) {
+ LC_Error(112,"(LI_Close)","");
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return;
+ }
+ }
+ }
+@@ -557,7 +568,8 @@ static FILE *LI_OpenIdxFil(LC_FILADM *pF
+ UT_strerror(szError,256,ierr);
+ UT_SNPRINTF(err().tx,LC_ERR_LEN," %s - %s",fil,szError);
+ LC_Error(6,"(LI_OpenIdxFil)",err().tx);
+- exit(2);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+
+ /* Posisjoner hvis nødvendig */
+@@ -804,12 +816,14 @@ void LI_PutSnr(LC_FILADM *pFil,long lSnr
+ } else {
+ UT_SNPRINTF(err().tx,LC_ERR_LEN,"%ld",lSnr);
+ LC_Error(61,"(LI_PutSnr): ",err().tx);
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return;
+ }
+
+ } else {
+ LC_Error(75,"(LI_PutSnr): ","");
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return;
+ }
+ }
+ }
+@@ -849,7 +863,8 @@ LC_GRTAB_LINJE * LI_GetGrt(LC_FILADM *pF
+
+ UT_SNPRINTF(err().tx,LC_ERR_LEN," %s : %ld",pFil->pszNavn,linje);
+ LC_Error(111,"(LI_GetGrt): ",err().tx);
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+
+ return NULL;
+ }
+@@ -891,7 +906,8 @@ LC_GRTAB_LINJE * LI_AppGrt(LC_FILADM *pF
+
+ } else {
+ LC_Error(75,"(LI_PutGrt): ",err().tx);
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+
+ return NULL;
+@@ -932,7 +948,8 @@ unsigned long LI_GetBt(LC_FILADM *pFil,l
+
+ UT_SNPRINTF(err().tx,LC_ERR_LEN," %s : %ld",pFil->pszNavn,linje);
+ LC_Error(111,"(LI_GetBt): ",err().tx);
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+
+ return 0L;
+ }
+@@ -976,7 +993,8 @@ void LI_PutBt(LC_FILADM *pFil,long linje
+
+ } else {
+ LC_Error(75,"(LI_PutBt): ",err().tx);
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return;
+ }
+ }
+
+@@ -1398,7 +1416,8 @@ void LI_SaveAdm(LC_FILADM *pFil)
+ pFil->ulPid = 0;
+ if (fwrite(pFil,sizeof(*pFil),1,pF) != 1) {
+ LC_Error(112,"(LI_SaveAdm)","");
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return;
+ }
+
+ fclose(pF);
+@@ -1547,7 +1566,8 @@ static short LI_ReadAdm(LC_FILADM *pFil)
+ if (fwrite(pFil,sizeof(*pFil),1,pF) != 1)
+ {
+ LC_Error(112,"(LI_ReadAdm)","");
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+
+ // Stenger filen
+@@ -1631,7 +1651,8 @@ void LI_WriteRb(LC_FILADM *pFil, UT_INT6
+ if (sSkrivefeil == UT_TRUE) {
+ UT_SNPRINTF(err().tx,LC_ERR_LEN," %s : %lld",pFil->pszNavn,n64FilPos);
+ LC_Error(74,"(LI_WriteRb): ",err().tx);
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return;
+ }
+
+ pFil->pBase->n64FilPosRb = _ftelli64(pF);
+@@ -1727,7 +1748,8 @@ void LI_ReadRb(LC_FILADM *pFil, UT_INT64
+ UT_SNPRINTF(err().tx,LC_ERR_LEN," %s : %lld",pFil->pszNavn,n64FilPos);
+
+ LC_Error(73,"(LI_ReadRb): ",err().tx);
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return;
+ }
+
+ pFil->pBase->n64FilPosRb = _ftelli64(pF);
+@@ -1799,7 +1821,8 @@ void LI_ReadCoordRb(LC_FILADM *pFil, UT_
+ if (sLesefeil == UT_TRUE) {
+ UT_SNPRINTF(err().tx,LC_ERR_LEN," %s : %lld",pFil->pszNavn,n64FilPos);
+ LC_Error(73,"(LI_ReadCoordRb): ",err().tx);
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return;
+ }
+
+ pFil->pBase->n64FilPosRb = _ftelli64(pF);
+--- a/src/FYBA/FYLO.cpp
++++ b/src/FYBA/FYLO.cpp
+@@ -757,11 +757,13 @@ SK_EntPnt_FYBA LC_BASEADM * LC_OpenBase(
+ */
+ if (fyba_initiert != 1){
+ LC_Error(4,"(LC_OpenBase)","");
+- exit(2);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+ if (sBaseType != LC_BASE && sBaseType != LC_KLADD) {
+ LC_Error(1,"(LC_OpenBase)","");
+- exit(2);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+
+ /*
+@@ -1149,17 +1151,20 @@ SK_EntPnt_FYBA short LC_OpenSos(const ch
+ */
+ if (fyba_initiert != 1) {
+ LC_Error(4,"(LC_OpenSos)","");
+- exit(2);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+ if (Sys.pForsteBase == NULL) {
+ LC_Error(5,"(LC_OpenSos)","");
+- exit(2);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+
+ if (Sys.pAktBase->sType == LC_KLADD) {
+ if (sModus == LC_BASE_FRAMGR || sModus == LC_BASE_BAKGR) {
+ LC_Error(106,"(LC_OpenSos)",fil);
+- exit(2);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+ }
+
+@@ -1471,7 +1476,8 @@ void LO_ReopenSos(LC_FILADM *pFil)
+ /* Åpningsfeil */
+ if (ostat != UT_OK) {
+ LC_Error(6,"(LO_ReopenSos)",pFil->pszNavn);
+- exit(2);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return;
+ }
+
+ /* Husk current filnummer */
+@@ -1982,7 +1988,8 @@ static short LO_InklSos(LC_FILADM *pFil,
+ } else { /* For mange grupper, tab. sprengt */
+ UT_SNPRINTF(err().tx,LC_ERR_LEN," %ld",pFil->lAntGr+1L);
+ LC_Error(2,"(LO_InklSos)",err().tx);
+- exit(99);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+
+ avbrutt = LC_Cancel(); /* <ESC> avbryter lesing */
+--- a/src/FYBA/Fyba_Callback.cpp
++++ b/src/FYBA/Fyba_Callback.cpp
+@@ -102,7 +102,8 @@ void LC_ErrorHandler (short feil_nr, con
+ case 4:
+ printf("\aTrykk [Enter] for å avbryte programmet:");
+ if (getchar() == 0) getchar();
+- exit(2);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return;
+ break;
+ }
+ }
+--- a/src/FYBA/fyln.cpp
++++ b/src/FYBA/fyln.cpp
+@@ -448,7 +448,8 @@ short LN_PakkNavn (LC_NAVNETABELL * pLn,
+ UT_FPRINTF(stderr,"%s\n",LN_VisNavn(pLn,nr));
+ }
+ LC_Error(21,"(LN_PakkNavn)","");
+- exit (2);
++ fprintf(stderr,"Error: The library used to stop the program execution here\n");
++ return 0;
+ }
+
+ /* ----- Nytt navn */
diff --git a/patches/02_fix_linking.patch b/patches/02_fix_linking.patch
new file mode 100644
index 0000000..eadb262
--- /dev/null
+++ b/patches/02_fix_linking.patch
@@ -0,0 +1,34 @@
+Description: This call makes libfyba link with libfyut and libfygm.
+Author: Ruben Undheim <ruben.undheim@gmail.com>
+
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,6 +1,6 @@
+ ACLOCAL_AMFLAGS = -I m4
+ AUTOMAKE_OPTIONS = foreign
+-SUBDIRS = src/GM src/UT src/FYBA doc
++SUBDIRS = src/UT src/GM src/FYBA doc
+
+ pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA = fyba.pc
+--- a/src/FYBA/Makefile.am
++++ b/src/FYBA/Makefile.am
+@@ -4,6 +4,8 @@ ACLOCAL_AMFLAGS = -I m5
+ lib_LTLIBRARIES = libfyba.la
+ libfyba_la_SOURCES = fyba.h Fyba_Callback.cpp FYBA_DLL.cpp FYHO.cpp FYLD.cpp FYLH.cpp fyln.cpp FYLP.cpp FYLS.cpp FYLX.cpp stdafx.cpp FYBA.cpp Fyba_melding.cpp FYLB.cpp FYLE.cpp FYLI.cpp FYLO.cpp FYLR.cpp FYLU.cpp FYTA.cpp fyba.h fyba_strings.h fybax.h stdafx.h
+ libfyba_la_LDFLAGS = -version-info 0:0:0
++libfyba_la_LIBADD = $(top_builddir)/src/UT/libfyut.la \
++ $(top_builddir)/src/GM/libfygm.la
+
+ library_includedir=$(includedir)/fyba
+ library_include_HEADERS = fyba.h
+--- a/src/GM/Makefile.am
++++ b/src/GM/Makefile.am
+@@ -4,6 +4,7 @@ ACLOCAL_AMFLAGS = -I m5
+ lib_LTLIBRARIES = libfygm.la
+ libfygm_la_SOURCES = fygm.h GM.cpp stdafx.cpp stdafx.h
+ libfygm_la_LDFLAGS = -version-info 0:0:0
++libfygm_la_LIBADD = $(top_builddir)/src/UT/libfyut.la
+
+ library_includedir=$(includedir)/fyba
+ library_include_HEADERS = fygm.h
diff --git a/patches/fix_issue.patch b/patches/fix_issue.patch
new file mode 100644
index 0000000..3db44f1
--- /dev/null
+++ b/patches/fix_issue.patch
@@ -0,0 +1,859 @@
+Description: With GCC 6, it's problematic to define the min and max
+ macros. Rename them to fymin and fymax.
+Author: Ruben Undheim <ruben.undheim@gmail.com>
+Last-Update: 2016-08-19
+
+--- a/src/FYBA/FYLU.cpp
++++ b/src/FYBA/FYLU.cpp
+@@ -8,12 +8,16 @@
+
+ #include <ctype.h>
+ #include <math.h>
+-#include <locale>
++
++#define fymin(a,b) (((a)<(b))?(a):(b))
++#define fymax(a,b) (((a)>(b))?(a):(b))
++
+
+ using namespace std;
+
+ #define U_PARA_LEN 128 /* Max lengde av parameterstreng */
+
++#include <locale>
+
+ /* Felles variabler for hele FYBA */
+ extern LC_SYSTEMADM Sys;
+@@ -1232,7 +1236,7 @@ static short LU_PiTestLinje(LC_UTVALG_EL
+
+ } else if (metode == LC_U_IKKEFLERE) { /* Metode "!FL" */
+ /* Teller opp antall av dette SOSI-navnet */
+- lMaxAntall = max(atol(pUE->min),1l);
++ lMaxAntall = fymax(atol(pUE->min),1l);
+ tilslag = 0;
+
+ while (LC_GetPiVerdi(pUE->sosi,lPnr,&sSett) != NULL) {
+@@ -1831,7 +1835,7 @@ static short LU_GiTestLinje(LC_UT_ADM *
+ /* Metode "!FL" */
+ } else if (metode == LC_U_IKKEFLERE) {
+ /* Teller opp antall av dette SOSI-navnet */
+- lMaxAntall = max(atol(pUE->min),1l);
++ lMaxAntall = fymax(atol(pUE->min),1l);
+ tilslag = 0;
+ while ((*apara = LC_GetGP(pUE->sosi,gilin,9999)) != NULL) {
+ tilslag++;
+@@ -2097,10 +2101,10 @@ static void LU_JustPara(char *para,short
+ if (cp != NULL){
+ if (start != 0){
+ if (slutt != 0){
+- slutt = min(slutt,((short)strlen(cp)));
++ slutt = fymin(slutt,((short)strlen(cp)));
+ *(cp+slutt) = '\0';
+ }
+- start = min(start,((short)strlen(cp)));
++ start = fymin(start,((short)strlen(cp)));
+ cp += (start-1);
+ }
+ UT_StrCopy(akt_para,cp,max_len);
+--- a/include/fyut.h
++++ b/include/fyut.h
+@@ -125,8 +125,8 @@
+
+
+ /* ----------------------------------------- Makroer */
+-#define max(a,b) (((a) > (b)) ? (a) : (b))
+-#define min(a,b) (((a) < (b)) ? (a) : (b))
++#define fymax(a,b) (((a) > (b)) ? (a) : (b))
++#define fymin(a,b) (((a) < (b)) ? (a) : (b))
+
+
+
+--- a/src/GM/GM.cpp
++++ b/src/GM/GM.cpp
+@@ -20,8 +20,8 @@
+ #define GM_ACCY 1.0E-8
+
+ /* --- Makroer -- */
+-#define max(a,b) (((a) > (b)) ? (a) : (b))
+-#define min(a,b) (((a) < (b)) ? (a) : (b))
++#define fymax(a,b) (((a) > (b)) ? (a) : (b))
++#define fymin(a,b) (((a) < (b)) ? (a) : (b))
+
+
+ /*
+@@ -214,10 +214,10 @@ SK_EntPnt_GM short GM_wtstPunkt(double P
+ short sAntSkjaer;
+
+ // Sjekk 1: Ligger punktet utenfor omskrevet rektangel - så ligger det utenfor vinduet
+- dPolyMaxA=max(wa1,wa2); dPolyMaxA=max(dPolyMaxA,wa3); dPolyMaxA=max(dPolyMaxA,wa4);
+- dPolyMaxN=max(wn1,wn2); dPolyMaxN=max(dPolyMaxN,wn3); dPolyMaxN=max(dPolyMaxN,wn4);
+- dPolyMinA=min(wa1,wa2); dPolyMinA=min(dPolyMinA,wa3); dPolyMinA=min(dPolyMinA,wa4);
+- dPolyMinN=min(wn1,wn2); dPolyMinN=min(dPolyMinN,wn3); dPolyMinN=min(dPolyMinN,wn4);
++ dPolyMaxA=fymax(wa1,wa2); dPolyMaxA=fymax(dPolyMaxA,wa3); dPolyMaxA=fymax(dPolyMaxA,wa4);
++ dPolyMaxN=fymax(wn1,wn2); dPolyMaxN=fymax(dPolyMaxN,wn3); dPolyMaxN=fymax(dPolyMaxN,wn4);
++ dPolyMinA=fymin(wa1,wa2); dPolyMinA=fymin(dPolyMinA,wa3); dPolyMinA=fymin(dPolyMinA,wa4);
++ dPolyMinN=fymin(wn1,wn2); dPolyMinN=fymin(dPolyMinN,wn3); dPolyMinN=fymin(dPolyMinN,wn4);
+ if((PktA>dPolyMaxA) || (PktA<dPolyMinA) || (PktN>dPolyMaxN) || (PktN<dPolyMinN))
+ return 0;
+
+@@ -276,16 +276,16 @@ SK_EntPnt_GM short GM_sver(double ka,dou
+ unsigned int kryss = 0;
+ double mini,maxi;
+
+- mini = min(ka,la);
+- maxi = max(ka,la);
++ mini = fymin(ka,la);
++ maxi = fymax(ka,la);
+
+ if (na >= mini && ma <= maxi){ /* (ma er lik na) */
+ if (fabs(la-ka) > 0.0001){
+ /* Beregn skjæringspunktet */
+ *sa = ma;
+ *sn = kn + ((*sa-ka)*(ln-kn))/(la-ka);
+- mini = min(mn,nn) - ACCY;
+- maxi = max(mn,nn) + ACCY;
++ mini = fymin(mn,nn) - ACCY;
++ maxi = fymax(mn,nn) + ACCY;
+ /* Sjekk om det er skjæring */
+ kryss = (unsigned int)(*sn >= mini && *sn <= maxi);
+ }
+@@ -335,16 +335,16 @@ SK_EntPnt_GM short GM_shor(double ka,dou
+ unsigned int kryss = 0;
+ double mini,maxi;
+
+- mini = min(kn,ln);
+- maxi = max(kn,ln);
++ mini = fymin(kn,ln);
++ maxi = fymax(kn,ln);
+
+ if (mn >= mini && nn <= maxi){ /* (mn er lik nn) */
+ if (fabs(ln-kn) > 0.0001){
+ /* Beregn skjæringspunktet */
+ *sn = mn;
+ *sa = ka + ((*sn-kn)*(la-ka))/(ln-kn);
+- mini = min(ma,na) - ACCY;
+- maxi = max(ma,na) + ACCY;
++ mini = fymin(ma,na) - ACCY;
++ maxi = fymax(ma,na) + ACCY;
+ /* Sjekk om det er skjæring */
+ kryss = (unsigned int)(*sa >= mini && *sa <= maxi);
+ }
+@@ -401,10 +401,10 @@ SK_EntPnt_GM short GM_sLinLin(double ka,
+
+
+ /* Sorterer først ut åpenbare tilfeller der det ikke er skjæring */
+- if (max(ka,la) < min(ma,na)) return 0;
+- if (min(ka,la) > max(ma,na)) return 0;
+- if (max(kn,ln) < min(mn,nn)) return 0;
+- if (min(kn,ln) > max(mn,nn)) return 0;
++ if (fymax(ka,la) < fymin(ma,na)) return 0;
++ if (fymin(ka,la) > fymax(ma,na)) return 0;
++ if (fymax(kn,ln) < fymin(mn,nn)) return 0;
++ if (fymin(kn,ln) > fymax(mn,nn)) return 0;
+
+ det = anm * nlk - nnm * alk;
+
+@@ -429,10 +429,10 @@ SK_EntPnt_GM short GM_sLinLin(double ka,
+ * Sjekker etterpå om skjæringspunktet ligger på linjebitene.
+ */
+ if (GM_sVektVekt(ka,kn,la,ln,ma,mn,na,nn,sa,sn)){
+- if (*sn <= max(kn,ln)+ACCY && *sn >= min(kn,ln)-ACCY &&
+- *sa <= max(ka,la)+ACCY && *sa >= min(ka,la)-ACCY &&
+- *sn <= max(mn,nn)+ACCY && *sn >= min(mn,nn)-ACCY &&
+- *sa <= max(ma,na)+ACCY && *sa >= min(ma,na)-ACCY) {
++ if (*sn <= fymax(kn,ln)+ACCY && *sn >= fymin(kn,ln)-ACCY &&
++ *sa <= fymax(ka,la)+ACCY && *sa >= fymin(ka,la)-ACCY &&
++ *sn <= fymax(mn,nn)+ACCY && *sn >= fymin(mn,nn)-ACCY &&
++ *sa <= fymax(ma,na)+ACCY && *sa >= fymin(ma,na)-ACCY) {
+
+ return 1; /* Skjæring funnet ==> returnerer */
+ }
+@@ -486,17 +486,17 @@ CD kryss = GM_Overlapp(ka,kn,la,ln,ma,mn
+ SK_EntPnt_GM short GM_Overlapp(double ka,double kn,double la,double ln,double ma,double mn,double na,double nn)
+ {
+ // Sorterer først ut åpenbare tilfeller der det ikke er skjæring
+- if (max(ka,la) < min(ma,na)) return 0;
+- if (min(ka,la) > max(ma,na)) return 0;
+- if (max(kn,ln) < min(mn,nn)) return 0;
+- if (min(kn,ln) > max(mn,nn)) return 0;
++ if (fymax(ka,la) < fymin(ma,na)) return 0;
++ if (fymin(ka,la) > fymax(ma,na)) return 0;
++ if (fymax(kn,ln) < fymin(mn,nn)) return 0;
++ if (fymin(kn,ln) > fymax(mn,nn)) return 0;
+
+
+ // Linjene er like
+- if (fabs((min(ka,la) - min(ma,na))) < GM_ACCY &&
+- fabs((max(ka,la) - max(ma,na))) < GM_ACCY &&
+- fabs((min(kn,ln) - min(mn,nn))) < GM_ACCY &&
+- fabs((max(kn,ln) - max(mn,nn))) < GM_ACCY)
++ if (fabs((fymin(ka,la) - fymin(ma,na))) < GM_ACCY &&
++ fabs((fymax(ka,la) - fymax(ma,na))) < GM_ACCY &&
++ fabs((fymin(kn,ln) - fymin(mn,nn))) < GM_ACCY &&
++ fabs((fymax(kn,ln) - fymax(mn,nn))) < GM_ACCY)
+ {
+ return 3;
+ }
+@@ -594,10 +594,10 @@ SK_EntPnt_GM short GM_sVektVekt(double k
+
+
+ /* Sorterer først ut åpenbare tilfeller der det ikke er skjæring */
+- //if (max(ka,la) < min(ma,na)) return 0;
+- //if (min(ka,la) > max(ma,na)) return 0;
+- //if (max(kn,ln) < min(mn,nn)) return 0;
+- //if (min(kn,ln) > max(mn,nn)) return 0;
++ //if (fymax(ka,la) < fymin(ma,na)) return 0;
++ //if (fymin(ka,la) > fymax(ma,na)) return 0;
++ //if (fymax(kn,ln) < fymin(mn,nn)) return 0;
++ //if (fymin(kn,ln) > fymax(mn,nn)) return 0;
+
+ det = anm * nlk - nnm * alk;
+
+@@ -679,10 +679,10 @@ SK_EntPnt_GM short GM_sLinBue(double sa,
+
+ /* Sjekk om punktene ligger på linjen */
+ if (kryss > 0){
+- minn = min(kn,ln) - ACCY;
+- mina = min(ka,la) - ACCY;
+- maxn = max(kn,ln) + ACCY;
+- maxa = max(ka,la) + ACCY;
++ minn = fymin(kn,ln) - ACCY;
++ mina = fymin(ka,la) - ACCY;
++ maxn = fymax(kn,ln) + ACCY;
++ maxa = fymax(ka,la) + ACCY;
+
+ if (kryss == 2){
+ if (! (*a2 <= maxa && *a2 >= mina &&
+@@ -1025,8 +1025,8 @@ SK_EntPnt_GM short GM_fotp(double a1,dou
+ }
+
+ /* Sjekk at fotpunktet er på linjen */
+- //if ( (*nf <= max(n1,n2)+ACCY) && (*nf >= min(n1,n2)-ACCY) ) {
+- if ( (*nf <= max(n1,n2)) && (*nf >= min(n1,n2)) ) {
++ //if ( (*nf <= fymax(n1,n2)+ACCY) && (*nf >= fymin(n1,n2)-ACCY) ) {
++ if ( (*nf <= fymax(n1,n2)) && (*nf >= fymin(n1,n2)) ) {
+ beregnet = 2;
+ } else {
+ beregnet = 1;
+@@ -1038,8 +1038,8 @@ SK_EntPnt_GM short GM_fotp(double a1,dou
+ *nf = n1;
+
+ /* Sjekk at fotpunktet er på linjen */
+- //if ( (*af <= max(a1,a2)+ACCY) && (*af >= min(a1,a2)-ACCY) ) {
+- if ( (*af <= max(a1,a2)) && (*af >= min(a1,a2)) ) {
++ //if ( (*af <= fymax(a1,a2)+ACCY) && (*af >= fymin(a1,a2)-ACCY) ) {
++ if ( (*af <= fymax(a1,a2)) && (*af >= fymin(a1,a2)) ) {
+ beregnet = 2;
+ } else {
+ beregnet = 1;
+@@ -1073,10 +1073,10 @@ SK_EntPnt_GM short GM_fotp(double a1,dou
+ */
+
+ /* Sjekk at fotpunktet er på linjen */
+- //if (*nf <= (max(n1,n2)+ACCY) && *nf >= (min(n1,n2)-ACCY) &&
+- // *af <= (max(a1,a2)+ACCY) && *af >= (min(a1,a2)-ACCY)){
+- if (*nf <= (max(n1,n2)) && *nf >= (min(n1,n2)) &&
+- *af <= (max(a1,a2)) && *af >= (min(a1,a2))){
++ //if (*nf <= (fymax(n1,n2)+ACCY) && *nf >= (fymin(n1,n2)-ACCY) &&
++ // *af <= (fymax(a1,a2)+ACCY) && *af >= (fymin(a1,a2)-ACCY)){
++ if (*nf <= (fymax(n1,n2)) && *nf >= (fymin(n1,n2)) &&
++ *af <= (fymax(a1,a2)) && *af >= (fymin(a1,a2))){
+ beregnet = 2; /* På linjen */
+ } else {
+ beregnet = 1; /* Utenfor linjen */
+@@ -1186,7 +1186,7 @@ SK_EntPnt_GM short GM_fotp_ny(double a1,
+ }
+
+ /* Sjekk at fotpunktet er på linjen */
+- if ( (*nf <= max(n1,n2)+ACCY) && (*nf >= min(n1,n2)-ACCY) ) {
++ if ( (*nf <= fymax(n1,n2)+ACCY) && (*nf >= fymin(n1,n2)-ACCY) ) {
+ beregnet = 2;
+ } else {
+ beregnet = 1;
+@@ -1198,7 +1198,7 @@ SK_EntPnt_GM short GM_fotp_ny(double a1,
+ *nf = n1;
+
+ /* Sjekk at fotpunktet er på linjen */
+- if ( (*af <= max(a1,a2)+ACCY) && (*af >= min(a1,a2)-ACCY) ) {
++ if ( (*af <= fymax(a1,a2)+ACCY) && (*af >= fymin(a1,a2)-ACCY) ) {
+ beregnet = 2;
+ } else {
+ beregnet = 1;
+@@ -1212,12 +1212,12 @@ SK_EntPnt_GM short GM_fotp_ny(double a1,
+ // Forslag til ny metode for fotpunktberegning. Endrer ikke de opprinnelige punktene,
+ // og det blir da mulig å gi korrekt tilbakemelding om punktet ligger inne på den gitte linjen.
+ retning = GM_RetnGon(a1,n1,a2,n2);
+- GM_PolRettv(&ap1, &np1, retning+100.0, max(da,dn));
++ GM_PolRettv(&ap1, &np1, retning+100.0, fymax(da,dn));
+ GM_sVektVekt(a1,n1,a2,n2,ap,np,ap1,np1,af,nf);
+
+ /* Sjekk at fotpunktet er på linjen */
+- if (*nf <= (max(n1,n2)+ACCY) && *nf >= (min(n1,n2)-ACCY) &&
+- *af <= (max(a1,a2)+ACCY) && *af >= (min(a1,a2)-ACCY)){
++ if (*nf <= (fymax(n1,n2)+ACCY) && *nf >= (fymin(n1,n2)-ACCY) &&
++ *af <= (fymax(a1,a2)+ACCY) && *af >= (fymin(a1,a2)-ACCY)){
+ beregnet = 2; /* På linjen */
+ } else {
+ beregnet = 1; /* Utenfor linjen */
+@@ -1658,8 +1658,8 @@ SK_EntPnt_GM short GM_bepa(double a1, do
+
+ if(atmp > ACCY || ntmp > ACCY) {
+
+- dmx = max(atmp,ntmp);
+- dmn = min(atmp,ntmp);
++ dmx = fymax(atmp,ntmp);
++ dmn = fymin(atmp,ntmp);
+ div = dmn / dmx;
+
+ rinv = 1.0 / (dmx * sqrt(1.0+div*div));
+@@ -2035,10 +2035,10 @@ SK_EntPnt_GM void GM_buebox(double as,do
+ a2 = as + r*cos(fi+dfi);
+ n2 = ns + r*sin(fi+dfi);
+
+- *nva = min(a1,a2);
+- *nvn = min(n1,n2);
+- *oha = max(a1,a2);
+- *ohn = max(n1,n2);
++ *nva = fymin(a1,a2);
++ *nvn = fymin(n1,n2);
++ *oha = fymax(a1,a2);
++ *ohn = fymax(n1,n2);
+
+ // For hver akse (fra sentrumspunktet) som krysses utvides omskrevet boks
+ radius = fabs(radius);
+@@ -2103,27 +2103,27 @@ SK_EntPnt_GM void GM_buebox(double as,do
+ if (fi >= 0.0 && fi < PI/2.0){
+ // Slutt i 1. kvadrant
+ if (r2 >= 0.0 && r2 < PI/2.0){
+- *nva = min(a1,a2);
+- *nvn = min(n1,n2);
+- *oha = max(a1,a2);
+- *ohn = max(n1,n2);
++ *nva = fymin(a1,a2);
++ *nvn = fymin(n1,n2);
++ *oha = fymax(a1,a2);
++ *ohn = fymax(n1,n2);
+ // Slutt i 2. kvadrant
+ } else if (r2 >= PI/2.0L && r2 < PI){
+- *nva = min(a1,a2);
+- *nvn = min(n1,n2);
+- *oha = max(a1,a2);
++ *nva = fymin(a1,a2);
++ *nvn = fymin(n1,n2);
++ *oha = fymax(a1,a2);
+ *ohn = ns + r;
+ // Slutt i 3. kvadrant
+ } else if (r2 >=PI && r2 < PI*3.0L/2.0L){
+ *nva = as - r;
+- *nvn = min(n1,n2);
+- *oha = max(a1,a2);
++ *nvn = fymin(n1,n2);
++ *oha = fymax(a1,a2);
+ *ohn = ns + r;
+ // Slutt i 4. kvadrant
+ } else{
+ *nva = as - r;
+ *nvn = ns - r;
+- *oha = max(a1,a2);
++ *oha = fymax(a1,a2);
+ *ohn = ns + r;
+ }
+
+@@ -2134,82 +2134,82 @@ SK_EntPnt_GM void GM_buebox(double as,do
+ *nva = as - r;
+ *nvn = ns - r;
+ *oha = as + r;
+- *ohn = max(n1,n2);
++ *ohn = fymax(n1,n2);
+ // Slutt i 2. kvadrant
+ } else if (r2 >= PI/2.0L && r2 < PI){
+- *nva = min(a1,a2);
+- *nvn = min(n1,n2);
+- *oha = max(a1,a2);
+- *ohn = max(n1,n2);
++ *nva = fymin(a1,a2);
++ *nvn = fymin(n1,n2);
++ *oha = fymax(a1,a2);
++ *ohn = fymax(n1,n2);
+ // Slutt i 3. kvadrant
+ } else if (r2 >=PI && r2 < PI*3.0L/2.0L){
+ *nva = as - r;
+- *nvn = min(n1,n2);
+- *oha = max(a1,a2);
+- *ohn = max(n1,n2);
++ *nvn = fymin(n1,n2);
++ *oha = fymax(a1,a2);
++ *ohn = fymax(n1,n2);
+ // Slutt i 4. kvadrant
+ } else{
+ *nva = as - r;
+ *nvn = ns - r;
+- *oha = max(a1,a2);
+- *ohn = max(n1,n2);
++ *oha = fymax(a1,a2);
++ *ohn = fymax(n1,n2);
+ }
+
+ // Start i 3. kvadrant
+ } else if (fi >=PI && fi < PI*3.0L/2.0L){
+ // Slutt i 1. kvadrant
+ if (r2 >= 0.0 && r2 < PI/2.0){
+- *nva = min(a1,a2);
++ *nva = fymin(a1,a2);
+ *nvn = ns - r;
+ *oha = as + r;
+- *ohn = max(n1,n2);
++ *ohn = fymax(n1,n2);
+ // Slutt i 2. kvadrant
+ } else if (r2 >= PI/2.0L && r2 < PI){
+- *nva = min(a1,a2);
++ *nva = fymin(a1,a2);
+ *nvn = ns - r;
+ *oha = as + r;
+ *ohn = ns + r;
+ // Slutt i 3. kvadrant
+ } else if (r2 >=PI && r2 < PI*3.0L/2.0L){
+- *nva = min(a1,a2);
+- *nvn = min(n1,n2);
+- *oha = max(a1,a2);
+- *ohn = max(n1,n2);
++ *nva = fymin(a1,a2);
++ *nvn = fymin(n1,n2);
++ *oha = fymax(a1,a2);
++ *ohn = fymax(n1,n2);
+ } else{
+ // Slutt i 4. kvadrant
+- *nva = min(a1,a2);
++ *nva = fymin(a1,a2);
+ *nvn = ns - r;
+- *oha = max(a1,a2);
+- *ohn = max(n1,n2);
++ *oha = fymax(a1,a2);
++ *ohn = fymax(n1,n2);
+ }
+
+ // Start i 4. kvadrant
+ } else {
+ // Slutt i 1. kvadrant
+ if (r2 >= 0.0 && r2 < PI/2.0) {
+- *nva = min(a1,a2);
+- *nvn = min(n1,n2);
++ *nva = fymin(a1,a2);
++ *nvn = fymin(n1,n2);
+ *oha = as + r;
+- *ohn = max(n1,n2);
++ *ohn = fymax(n1,n2);
+ // Slutt i 2. kvadrant
+ } else if (r2 >= PI/2.0L && r2 < PI) {
+- *nva = min(a1,a2);
+- *nvn = min(n1,n2);
++ *nva = fymin(a1,a2);
++ *nvn = fymin(n1,n2);
+ *oha = as + r;
+ *ohn = ns + r;
+
+ // Slutt i 3. kvadrant
+ } else if (r2 >=PI && r2 < PI*3.0L/2.0L) {
+ *nva = as - r;
+- *nvn = min(n1,n2);
++ *nvn = fymin(n1,n2);
+ *oha = as + r;
+ *ohn = ns + r;
+ // Slutt i 4. kvadrant
+ } else {
+- *nva = min(a1,a2);
+- *nvn = min(n1,n2);
+- *oha = max(a1,a2);
+- *ohn = max(n1,n2);
++ *nva = fymin(a1,a2);
++ *nvn = fymin(n1,n2);
++ *oha = fymax(a1,a2);
++ *ohn = fymax(n1,n2);
+ }
+ }
+ }
+--- a/src/UT/fyut.h
++++ b/src/UT/fyut.h
+@@ -125,8 +125,8 @@
+
+
+ /* ----------------------------------------- Makroer */
+-#define max(a,b) (((a) > (b)) ? (a) : (b))
+-#define min(a,b) (((a) < (b)) ? (a) : (b))
++#define fymax(a,b) (((a) > (b)) ? (a) : (b))
++#define fymin(a,b) (((a) < (b)) ? (a) : (b))
+
+
+
+--- a/src/FYBA/FYLI.cpp
++++ b/src/FYBA/FYLI.cpp
+@@ -1141,8 +1141,8 @@ CD LC_EraseBt(fra_kol,til_kol);
+ SK_EntPnt_FYBA void LC_EraseBt(short fra_kol,short til_kol)
+ {
+ /* Beregner lovlige kolonner */
+- fra_kol = max(fra_kol,BT_MIN_USER);
+- til_kol = min(til_kol,BT_MAX_USER);
++ fra_kol = fymax(fra_kol,BT_MIN_USER);
++ til_kol = fymin(til_kol,BT_MAX_USER);
+
+ LI_EraseBt(fra_kol,til_kol);
+ }
+@@ -1248,8 +1248,8 @@ void LI_EraseBt(short fra_kol,short til_
+ LC_FILADM *pFil;
+
+ /* Beregner lovlige områder */
+- fra_kol = max(fra_kol,BT_MIN_BT);
+- til_kol = min(til_kol,BT_MAX_BT);
++ fra_kol = fymax(fra_kol,BT_MIN_BT);
++ til_kol = fymin(til_kol,BT_MAX_BT);
+
+ maske = 0x0000; /* Lager slettemaske */
+ for ( ; fra_kol <= til_kol; fra_kol++){
+@@ -1302,8 +1302,8 @@ SK_EntPnt_FYBA void LC_CopyBt(short fra_
+ unsigned long ul;
+
+ /* Beregner lovlige områder */
+- fra_kol = min(max(fra_kol,0),BT_MAX_BT);
+- til_kol = min(max(til_kol,0),BT_MAX_USER);
++ fra_kol = fymin(fymax(fra_kol,0),BT_MAX_BT);
++ til_kol = fymin(fymax(til_kol,0),BT_MAX_USER);
+
+ /* Returner verdi */
+ maske_fra = 0x00000001UL << fra_kol;
+--- a/src/FYBA/FYLO.cpp
++++ b/src/FYBA/FYLO.cpp
+@@ -1598,10 +1598,10 @@ SK_EntPnt_FYBA void LC_CloseSos(LC_FILAD
+ if (pFil->usLag & (LC_FRAMGR | LC_BAKGR)) {
+ /* Filen inneholder data */
+ if (pFil->pGeoRN != NULL) {
+- pB->dMinAust = min(pB->dMinAust,pFil->Omraade.dMinAust);
+- pB->dMinNord = min(pB->dMinNord,pFil->Omraade.dMinNord);
+- pB->dMaxAust = max(pB->dMaxAust,pFil->Omraade.dMaxAust);
+- pB->dMaxNord = max(pB->dMaxNord,pFil->Omraade.dMaxNord);
++ pB->dMinAust = fymin(pB->dMinAust,pFil->Omraade.dMinAust);
++ pB->dMinNord = fymin(pB->dMinNord,pFil->Omraade.dMinNord);
++ pB->dMaxAust = fymax(pB->dMaxAust,pFil->Omraade.dMaxAust);
++ pB->dMaxNord = fymax(pB->dMaxNord,pFil->Omraade.dMaxNord);
+ }
+ }
+ pFil = pFil->pNesteFil;
+@@ -1789,10 +1789,10 @@ SK_EntPnt_FYBA short LC_GetBaOm(unsigned
+ while (LC_NextFil(&pFil,usLag)) {
+ sAntall++;
+ if (LC_GetFiOm(pFil,&na,&nn,&oa,&on)) {
+- *nva = min (*nva, na);
+- *nvn = min (*nvn, nn);
+- *oha = max (*oha, oa);
+- *ohn = max (*ohn, on);
++ *nva = fymin(*nva, na);
++ *nvn = fymin(*nvn, nn);
++ *oha = fymax(*oha, oa);
++ *ohn = fymax(*ohn, on);
+ }
+ }
+
+@@ -2034,10 +2034,10 @@ static short LO_InklSos(LC_FILADM *pFil,
+ if (pFil->usLag & (LC_FRAMGR | LC_BAKGR)) {
+ /* Filen inneholder data */
+ if (pFil->pGeoRN != NULL) {
+- pB->dMinAust = min(pB->dMinAust,pFil->Omraade.dMinAust);
+- pB->dMinNord = min(pB->dMinNord,pFil->Omraade.dMinNord);
+- pB->dMaxAust = max(pB->dMaxAust,pFil->Omraade.dMaxAust);
+- pB->dMaxNord = max(pB->dMaxNord,pFil->Omraade.dMaxNord);
++ pB->dMinAust = fymin(pB->dMinAust,pFil->Omraade.dMinAust);
++ pB->dMinNord = fymin(pB->dMinNord,pFil->Omraade.dMinNord);
++ pB->dMaxAust = fymax(pB->dMaxAust,pFil->Omraade.dMaxAust);
++ pB->dMaxNord = fymax(pB->dMaxNord,pFil->Omraade.dMaxNord);
+ }
+ }
+ pFil = pFil->pNesteFil;
+--- a/src/FYBA/FYLX.cpp
++++ b/src/FYBA/FYLX.cpp
+@@ -2086,7 +2086,7 @@ SK_EntPnt_FYBA char *LC_GetGP(const char
+ if (sSlutt != 0 && sSlutt < (short)strlen(rp)) {
+ *(rp+sSlutt) = '\0';
+ }
+- sStart = min(sStart,((short)strlen(rp)));
++ sStart = fymin(sStart,((short)strlen(rp)));
+ rp += (sStart-1);
+ }
+
+@@ -2279,7 +2279,7 @@ SK_EntPnt_FYBA char *LC_GetPiVerdi(const
+ /* Hent enhet og formater høyden */
+ niv = 2;
+ LC_GetCurEnhet(Sys.GrId.pFil,&niv,&enhet,&enhet_h,&enhet_d);
+- sAntDes = UT_RoundDS(fabs(min(0.0,log10(enhet_h))));
++ sAntDes = UT_RoundDS(fabs(fymin(0.0,log10(enhet_h))));
+ UT_SNPRINTF(format,20,"%%.%dlf",sAntDes);
+ UT_SNPRINTF(retur_str,LC_MAX_SOSI_LINJE_LEN,format,h);
+ funnet = UT_TRUE;
+@@ -2329,7 +2329,7 @@ SK_EntPnt_FYBA char *LC_GetPiVerdi(const
+ if (sSlutt != 0 && sSlutt < (short)strlen(rp)) {
+ *(rp+sSlutt) = '\0';
+ }
+- sStart = min(sStart,((short)strlen(rp)));
++ sStart = fymin(sStart,((short)strlen(rp)));
+ rp += (sStart-1);
+ }
+
+@@ -2600,7 +2600,7 @@ SK_EntPnt_FYBA short LC_PutGP(const char
+ if (sSlutt != 0 && sSlutt < (short)strlen(rp)) {
+ *(rp+sSlutt) = '\0';
+ }
+- sStart = min(sStart,((short)strlen(rp)));
++ sStart = fymin(sStart,((short)strlen(rp)));
+ rp += (sStart-1);
+ }
+
+@@ -2783,28 +2783,28 @@ SK_EntPnt_FYBA void LC_InitPP(char *sosi
+
+ UT_StrToken(sosi_navn,0,&itxu,LC_MAX_SOSINAVN_LEN,pp_stat->pinfo_navn); /* SOSI-navnet */
+ UT_StrUpper(pp_stat->pinfo_navn);
+- pp_stat->slutt_punkt = min(siste_punkt,Sys.pGrInfo->nko) + 1;
++ pp_stat->slutt_punkt = fymin(siste_punkt,Sys.pGrInfo->nko) + 1;
+
+ /* -------- Knutepunkt */
+ if (strcmp(pp_stat->pinfo_navn,"...KP") == 0){
+ pp_stat->type = LC_GETPP_KP;
+- pp_stat->curr_punkt = max(forste_punkt,1) -1; /* Sjekk punktnummer */
++ pp_stat->curr_punkt = fymax(forste_punkt,1) -1; /* Sjekk punktnummer */
+
+ /* -------- Høyde */
+ } else if (strcmp(pp_stat->pinfo_navn,"HØYDE") == 0) {
+ pp_stat->type = LC_GETPP_HOYDE;
+- pp_stat->curr_punkt = max(forste_punkt,1) -1; /* Sjekk punktnummer */
++ pp_stat->curr_punkt = fymax(forste_punkt,1) -1; /* Sjekk punktnummer */
+
+ /* -------- Kvalitet */
+ } else if (strcmp(pp_stat->pinfo_navn,"KVALITET") == 0) {
+ pp_stat->type = LC_GETPP_KVALITET;
+- pp_stat->curr_punkt = max(forste_punkt,1) -1; /* Sjekk punktnummer */
++ pp_stat->curr_punkt = fymax(forste_punkt,1) -1; /* Sjekk punktnummer */
+
+ /* -------- Annen PINFO */
+ } else {
+ pp_stat->type = LC_GETPP_VANLIG;
+ pp_stat->neste_tegn = 0;
+- pp_stat->curr_punkt = max(forste_punkt,1); /* Sjekk punktnummer */
++ pp_stat->curr_punkt = fymax(forste_punkt,1); /* Sjekk punktnummer */
+ }
+ }
+ }
+@@ -2874,7 +2874,7 @@ SK_EntPnt_FYBA char *LC_GetPP(long *punk
+ niv = 2;
+ LC_GetCurEnhet(Sys.GrId.pFil,&niv,&enhet,&enhet_h,&enhet_d);
+
+- sAntDes = UT_RoundDS(fabs(min(0.0,log10(enhet_h))));
++ sAntDes = UT_RoundDS(fabs(fymin(0.0,log10(enhet_h))));
+ UT_SNPRINTF(format,20,"%%.%dlf",sAntDes);
+ UT_SNPRINTF(retur_str,LC_MAX_SOSI_LINJE_LEN,format,h);
+
+@@ -3001,8 +3001,8 @@ short LC_FinnKp(long *forste_punkt,long
+
+ if (Sys.GrId.lNr != INGEN_GRUPPE){ /* Aktuell gruppe OK */
+ if(Sys.pGrInfo->info & GI_KP){ /* Gruppen har knutepunkt */
+- punkt = max(*forste_punkt,1); /* Sjekk punktnummer */
+- siste_punkt = min(siste_punkt,Sys.pGrInfo->nko);
++ punkt = fymax(*forste_punkt,1); /* Sjekk punktnummer */
++ siste_punkt = fymin(siste_punkt,Sys.pGrInfo->nko);
+
+ /* Skann gruppen */
+ for (punkt--; punkt<siste_punkt; ++punkt) {
+--- a/src/FYBA/FYLS.cpp
++++ b/src/FYBA/FYLS.cpp
+@@ -207,7 +207,7 @@ SK_EntPnt_FYBA long LC_FASn(LC_SNR_ADM *
+ LC_BGR AktBgr,Bgr;
+ long lSnr,lGrNr;
+ long lAntall = 0;
+- long lMaxSnr = min(pSnrAdm->pFil->lMaxSnr, pSnrAdm->lMaxSnr);
++ long lMaxSnr = fymin(pSnrAdm->pFil->lMaxSnr, pSnrAdm->lMaxSnr);
+
+
+ /* LO_TestFilpeker(pSnrAdm->pFil,"LC_FASn"); */
+@@ -269,7 +269,7 @@ SK_EntPnt_FYBA short LC_FFSn(LC_SNR_ADM
+ /* LO_TestFilpeker(pSnrAdm->pFil,"LC_FFSn"); */
+ LO_TestFilpeker(pSnrAdm->pFil,"FFSn");
+
+- lMaxSnr = min(pSnrAdm->pFil->lMaxSnr, pSnrAdm->lMaxSnr);
++ lMaxSnr = fymin(pSnrAdm->pFil->lMaxSnr, pSnrAdm->lMaxSnr);
+
+ /* Sjekker fra starten av søkeområdet */
+ for (lSnr=pSnrAdm->lMinSnr; lSnr<=lMaxSnr; lSnr++) {
+@@ -314,7 +314,7 @@ SK_EntPnt_FYBA short LC_FFSnBt(LC_SNR_AD
+ /* LO_TestFilpeker(pSnrAdm->pFil,"LC_FFSnBt"); */
+ LO_TestFilpeker(pSnrAdm->pFil,"FFSnBt");
+
+- lMaxSnr = min(pSnrAdm->pFil->lMaxSnr, pSnrAdm->lMaxSnr);
++ lMaxSnr = fymin(pSnrAdm->pFil->lMaxSnr, pSnrAdm->lMaxSnr);
+
+ /* Sjekker fra starten av søkeområdet */
+ for (lSnr=pSnrAdm->lMinSnr; lSnr<=lMaxSnr; lSnr++) {
+@@ -361,7 +361,7 @@ SK_EntPnt_FYBA short LC_FNSn(LC_SNR_ADM
+ /* LO_TestFilpeker(pSnrAdm->pFil,"LC_FNSn"); */
+ LO_TestFilpeker(pSnrAdm->pFil,"FNSn");
+
+- lMaxSnr = min(pSnrAdm->pFil->lMaxSnr, pSnrAdm->lMaxSnr);
++ lMaxSnr = fymin(pSnrAdm->pFil->lMaxSnr, pSnrAdm->lMaxSnr);
+
+ /* Sjekker fra aktuellt serienummer */
+ for (lSnr=pSnrAdm->lAktSnr+1L; lSnr<=lMaxSnr; lSnr++) {
+@@ -406,7 +406,7 @@ SK_EntPnt_FYBA short LC_FNSnBt(LC_SNR_AD
+ /* LO_TestFilpeker(pSnrAdm->pFil,"LC_FNSnBt"); */
+ LO_TestFilpeker(pSnrAdm->pFil,"FNSnBt");
+
+- lMaxSnr = min(pSnrAdm->pFil->lMaxSnr, pSnrAdm->lMaxSnr);
++ lMaxSnr = fymin(pSnrAdm->pFil->lMaxSnr, pSnrAdm->lMaxSnr);
+
+ /* Sjekker fra aktuellt serienummer */
+ for (lSnr=pSnrAdm->lAktSnr+1L; lSnr<=lMaxSnr; lSnr++) {
+@@ -540,7 +540,7 @@ SK_EntPnt_FYBA short LC_FLSn(LC_SNR_ADM
+ /* LO_TestFilpeker(pSnrAdm->pFil,"LC_FLSn"); */
+ LO_TestFilpeker(pSnrAdm->pFil,"FLSn");
+
+- lSnr = min(pSnrAdm->pFil->lMaxSnr, pSnrAdm->lMaxSnr);
++ lSnr = fymin(pSnrAdm->pFil->lMaxSnr, pSnrAdm->lMaxSnr);
+
+ /* Sjekker fra slutten av tabellen */
+ for (; lSnr>=pSnrAdm->lMinSnr; lSnr--) {
+@@ -586,7 +586,7 @@ SK_EntPnt_FYBA short LC_FLSnBt(LC_SNR_AD
+ /* LO_TestFilpeker(pSnrAdm->pFil,"LC_FLSnBt"); */
+ LO_TestFilpeker(pSnrAdm->pFil,"FLSnBt");
+
+- lSnr = min(pSnrAdm->pFil->lMaxSnr, pSnrAdm->lMaxSnr);
++ lSnr = fymin(pSnrAdm->pFil->lMaxSnr, pSnrAdm->lMaxSnr);
+
+ /* Sjekker fra slutten av tabellen */
+ for (; lSnr>=pSnrAdm->lMinSnr; lSnr--) {
+--- a/src/FYBA/FYLR.cpp
++++ b/src/FYBA/FYLR.cpp
+@@ -141,10 +141,10 @@ void LR_Indx(void)
+
+ // Spesialhandtering av ulogiske sirkler og buer. Håndteres som KURVE
+ for (pt=0; pt<Sys.pGrInfo->nko; pt++) {
+- min_a = min(min_a,*(Sys.pdAust + pt));
+- min_n = min(min_n,*(Sys.pdNord + pt));
+- max_a = max(max_a,*(Sys.pdAust + pt));
+- max_n = max(max_n,*(Sys.pdNord + pt));
++ min_a = fymin(min_a,*(Sys.pdAust + pt));
++ min_n = fymin(min_n,*(Sys.pdNord + pt));
++ max_a = fymax(max_a,*(Sys.pdAust + pt));
++ max_n = fymax(max_n,*(Sys.pdNord + pt));
+ }
+ }
+
+@@ -152,10 +152,10 @@ void LR_Indx(void)
+ } else {
+ /* Omskreven firkant */
+ for (pt=0; pt<Sys.pGrInfo->nko; pt++) {
+- min_a = min(min_a,*(Sys.pdAust + pt));
+- min_n = min(min_n,*(Sys.pdNord + pt));
+- max_a = max(max_a,*(Sys.pdAust + pt));
+- max_n = max(max_n,*(Sys.pdNord + pt));
++ min_a = fymin(min_a,*(Sys.pdAust + pt));
++ min_n = fymin(min_n,*(Sys.pdNord + pt));
++ max_a = fymax(max_a,*(Sys.pdAust + pt));
++ max_n = fymax(max_n,*(Sys.pdNord + pt));
+ }
+ }
+
+@@ -412,10 +412,10 @@ void LR_IndxFlate(void)
+ for (s=0; s<ant_ref; s++) {
+ pRL = LI_GetGeo(pFi,ref_arr[s]);
+ if (pRL != NULL) {
+- min_a = min(min_a, pRL->Boks.dMinAust);
+- min_n = min(min_n, pRL->Boks.dMinNord);
+- max_a = max(max_a, pRL->Boks.dMaxAust);
+- max_n = max(max_n, pRL->Boks.dMaxNord);
++ min_a = fymin(min_a, pRL->Boks.dMinAust);
++ min_n = fymin(min_n, pRL->Boks.dMinNord);
++ max_a = fymax(max_a, pRL->Boks.dMaxAust);
++ max_n = fymax(max_n, pRL->Boks.dMaxNord);
+ }
+ }
+
+@@ -1857,10 +1857,10 @@ CD =====================================
+ */
+ static void LR_R_BoksSum(LC_BOKS * pB1,LC_BOKS * pB2)
+ {
+- pB1->dMinAust = min(pB1->dMinAust,pB2->dMinAust);
+- pB1->dMinNord = min(pB1->dMinNord,pB2->dMinNord);
+- pB1->dMaxAust = max(pB1->dMaxAust,pB2->dMaxAust);
+- pB1->dMaxNord = max(pB1->dMaxNord,pB2->dMaxNord);
++ pB1->dMinAust = fymin(pB1->dMinAust,pB2->dMinAust);
++ pB1->dMinNord = fymin(pB1->dMinNord,pB2->dMinNord);
++ pB1->dMaxAust = fymax(pB1->dMaxAust,pB2->dMaxAust);
++ pB1->dMaxNord = fymax(pB1->dMaxNord,pB2->dMaxNord);
+ }
+
+
+@@ -1886,8 +1886,8 @@ static double LR_BoksDeltaArealSum(LC_BO
+ //lGml = (pB1->dMaxAust - pB1->dMinAust) * (pB1->dMaxNord - pB1->dMinNord);
+ //return (lNy - lGml);
+
+- double dDeltaAreal = (max(pB1->dMaxAust,pB2->dMaxAust) - min(pB1->dMinAust,pB2->dMinAust)) *
+- (max(pB1->dMaxNord,pB2->dMaxNord) - min(pB1->dMinNord,pB2->dMinNord));
++ double dDeltaAreal = (fymax(pB1->dMaxAust,pB2->dMaxAust) - fymin(pB1->dMinAust,pB2->dMinAust)) *
++ (fymax(pB1->dMaxNord,pB2->dMaxNord) - fymin(pB1->dMinNord,pB2->dMinNord));
+
+ return dDeltaAreal;
+ }
+--- a/src/FYBA/FYLB.cpp
++++ b/src/FYBA/FYLB.cpp
+@@ -710,8 +710,8 @@ SK_EntPnt_FYBA void LC_WsGrPart(LC_FILAD
+ /* OK ==> Skriv */
+ } else{
+ /* Sjekker at punktnummer er lovlig */
+- fra_punkt = min( max(1,fra_punkt), max(1,Sys.pGrInfo->nko) );
+- antall = min( max(antall,0), (Sys.pGrInfo->nko-fra_punkt+1) );
++ fra_punkt = fymin( fymax(1,fra_punkt), fymax(1,Sys.pGrInfo->nko) );
++ antall = fymin( fymax(antall,0), (Sys.pGrInfo->nko-fra_punkt+1) );
+
+ /* Skriver */
+ LB_WGru(SKRIV_SISTE,fra_punkt,antall,pFil,pFil->n64AktPos,&neste);
+@@ -2738,7 +2738,7 @@ CD LB_FormaterEnhet(streng,sStrengMaxLen
+ char *LB_FormaterEnhet(char *streng,short sStrengMaxLen,char *SosiNavn,double enhet)
+ {
+ char enhet_buffer[20],*cp;
+- short sAntDes = max(1,UT_RoundDS(fabs(min(1.0,log10(enhet)))));
++ short sAntDes = fymax(1,UT_RoundDS(fabs(fymin(1.0,log10(enhet)))));
+
+ UT_StrCopy(streng,SosiNavn,sStrengMaxLen);
+ UT_StrCat(streng," ",sStrengMaxLen);
+@@ -3014,11 +3014,11 @@ SK_EntPnt_FYBA short LC_DelGiL(short lin
+ if (antall > 0) {
+ Sys.sGrEndra = (short)END_ENDRA;
+
+- start = max(linje,2); /* 2 er første lovlige linje */
++ start = fymax(linje,2); /* 2 er første lovlige linje */
+ antall -= (start-linje); /* Juster antall tilsvarende */
+
+ /* Max antall er resten av GINFO */
+- antall = min(start+antall-1,Sys.pGrInfo->ngi) - start + 1;
++ antall = fymin(start+antall-1,Sys.pGrInfo->ngi) - start + 1;
+
+ if (start+antall <= Sys.pGrInfo->ngi) {
+ /* Beregn forflytting */
+@@ -3116,11 +3116,11 @@ SK_EntPnt_FYBA long LC_DelKoL(long linje
+ Sys.sGrEndra = (short)END_ENDRA;
+ if (linje <= Sys.lPibufPnr) Sys.sPibufStatus = LC_PIBUF_TOM;
+
+- start = max(linje,1); /* 1 er første lovlige linje */
++ start = fymax(linje,1); /* 1 er første lovlige linje */
+ antall -= (start-linje); /* Juster antall tilsvarende */
+
+ /* Max antall er resten av punktene */
+- antall = min(start+antall-1,Sys.pGrInfo->nko) - start + 1;
++ antall = fymin(start+antall-1,Sys.pGrInfo->nko) - start + 1;
+
+ /* UT_FPRINTF(stderr," %hd - %hd\n",start,antall); */
+
+--- a/src/UT/UT3.cpp
++++ b/src/UT/UT3.cpp
+@@ -68,7 +68,7 @@ SK_EntPnt_UT void UT_Pause (short dur)
+
+ UT_InqTime (tid);
+ t1 = 100*tid[2] + tid[3];
+- t2 = t1 + min (dur,6000);
++ t2 = t1 + fymin(dur,6000);
+ do {
+ UT_InqTime (tid);
+ t = 100*tid[2] + tid[3];
diff --git a/patches/series b/patches/series
new file mode 100644
index 0000000..50f440c
--- /dev/null
+++ b/patches/series
@@ -0,0 +1,3 @@
+01_noexit_in_library.patch
+02_fix_linking.patch
+fix_issue.patch
diff --git a/rules b/rules
new file mode 100755
index 0000000..4390ca9
--- /dev/null
+++ b/rules
@@ -0,0 +1,17 @@
+#!/usr/bin/make -f
+
+#export DH_VERBOSE=1
+
+# Enable hardening build flags
+export DEB_BUILD_MAINT_OPTIONS=hardening=+all
+
+export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
+
+%:
+ dh $@ --with autoreconf
+
+override_dh_strip:
+ dh_strip --dbgsym-migration='libfyba0-dbg (<< 4.1.1-4~)'
+
+override_dh_makeshlibs:
+ dh_makeshlibs -V
diff --git a/shlibs b/shlibs
new file mode 100644
index 0000000..13fde37
--- /dev/null
+++ b/shlibs
@@ -0,0 +1,3 @@
+libfyba 0 libfyba0
+libfyut 0 libfyba0
+libfygm 0 libfyba0
diff --git a/source/format b/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/source/lintian-overrides b/source/lintian-overrides
new file mode 100644
index 0000000..d9d9775
--- /dev/null
+++ b/source/lintian-overrides
@@ -0,0 +1,3 @@
+# Not worth the effort
+testsuite-autopkgtest-missing
+
diff --git a/upstream/metadata b/upstream/metadata
new file mode 100644
index 0000000..592edb4
--- /dev/null
+++ b/upstream/metadata
@@ -0,0 +1,6 @@
+---
+Bug-Database: https://github.com/kartverket/fyba/issues
+Bug-Submit: https://github.com/kartverket/fyba/issues/new
+Name: FYBA
+Repository: https://github.com/kartverket/fyba.git
+Repository-Browse: https://github.com/kartverket/fyba
diff --git a/watch b/watch
new file mode 100644
index 0000000..7e2a4b1
--- /dev/null
+++ b/watch
@@ -0,0 +1,7 @@
+version=3
+opts=\
+dversionmangle=s/\+(debian|dfsg|ds|deb)\d*$//,\
+uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/;s/RC/rc/,\
+filenamemangle=s/(?:.*?)?(?:rel|v|fyba)?[\-\_]?(\d\S+)\.(tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))/fyba-$1.$2/ \
+https://github.com/kartverket/fyba/releases \
+(?:.*?/)?(?:rel|v|fyba)?[\-\_]?(\d\S+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))