I haven't find the getopt.h file in my distribution, that's why I use unistd.h.
Original Message:
Sent: Thu December 07, 2023 08:54 AM
From: Art Kagel
Subject: Updated utils2_ak package available
Dennis:
I'm aware that getopt.h is included in several places. The file is included in the distribution so I'm wondering why you ran into a need to use unistd.h instead? I may need to add a note about that in the Building file.
Art
------------------------------
Art S. Kagel, President and Principal Consultant
ASK Database Management Corp.
www.askdbmgt.com
Original Message:
Sent: Thu December 07, 2023 08:05 AM
From: Dennis Melnikov
Subject: Updated utils2_ak package available
Art,
You have `#include <getopt.h>` in a couple of files. Below is my utils2_ak.patch file to apply against the source.
Before applying the patch I have to fix file permissions: `chmod 644 Makefile *.ec`
--- Makefile 2023-02-22 16:59:50.000000000 +0300
+++ Makefile.new 2023-12-07 12:08:29.000000000 +0300
@@ -5,7 +5,7 @@
# If your copy of GNU make is not called 'make' or is not first in
# your path set the variable MAKE appropriately so the recursive make
# of myschema will use the correct version of make.
- MAKE=make
+ MAKE=/opt/freeware/bin/make
.SUFFIXES:
.SUFFIXES: .ec .c .o
@@ -91,12 +91,12 @@
bload: ul
-rm bload 2>/dev/null
-ln ul bload
- -touch -h bload
+ -touch bload
bunload: ul
-rm bunload 2>/dev/null
-ln ul bunload
- -touch -h bunload
+ -touch bunload
printfreeB: printfreeB.ec
INFORMIXC=$(INFORMIXC) $(ESQL) $(ECFLAGS) -o $@ $^
--- dbdelete.ec 2023-10-26 22:52:42.000000000 +0300
+++ dbdelete.ec.new 2023-12-07 12:09:04.000000000 +0300
@@ -83,7 +83,11 @@
#include <string.h>
#include <errno.h>
#include <time.h>
+ #ifdef _AIX
+ #include <unistd.h>
+ #else
#include <getopt.h>
+ #endif
EXEC SQL include sqlca;
EXEC SQL include sqlda;
--- dbping.ec 2021-12-21 20:12:53.000000000 +0300
+++ dbping.ec.new 2023-12-07 12:09:22.000000000 +0300
@@ -86,7 +86,11 @@
#endif
#include <time.h>
#include <sys/time.h>
+ #ifdef _AIX
+ #include <unistd.h>
+ #else
#include <getopt.h>
+ #endif
#include <errno.h>
#define SQLOK 0
--- myschema.d/myschema.mk 2023-11-24 16:55:31.000000000 +0300
+++ myschema.d/myschema.mk.new 2023-12-07 12:40:37.000000000 +0300
@@ -4,12 +4,12 @@
SHELL=/usr/bin/ksh
VPATH=.:./RCS
- LDFLAGS= # none needed on most systems
+ # LDFLAGS= # none needed on most systems
# LDFLAGS=-static # static libraries are not compatible under GCC v5 or later
# LDFLAGS=-xarch=v9 # For Solaris 64bit versions
# LDFLAGS=-q64 # For AIX 64 bit mode using XLC
# LDFLAGS=-q64 -static # For AIX 64 bit mode & static link using XLC
- # LDFLAGS=-maix64 # For AIX 64 bit mode using GCC
+ LDFLAGS=-maix64 # For AIX 64 bit mode using GCC
CFLAGS=$(CDFLAGS)
# CFLAGS=$(CDFLAGS) -Ae # For HP-32bit executables
@@ -20,10 +20,10 @@
# ECFLAGS=$(CFLAGS) -EDbigint=int # For CSDK earlier than 3.50
# CDFLAGS=-g
- CDFLAGS=-O3 # Mostly only for GCC
+ # CDFLAGS=-O3 # Mostly only for GCC
# CDFLAGS=-O2 -qmaxmem=32768 # For AIX using XLC to improve optimization.
# CDFLAGS=-O2 -qmaxmem=32768 -q64 # For AIX 64bit using XLC
- # CDFLAGS=-O3 -maix64 # For AIX 64bit using GCC
+ CDFLAGS=-O2 -maix64 # For AIX 64bit using GCC
# CDFLAGS=-O # For HP and other systems that do not have -O3
# CDFLAGS=-Onolimit # For myschema.ec only - the HP compiler complains that
# # it does not have enough memory to optimize & suggests
------------------------------
Sincerely,
Dennis
Original Message:
Sent: Wed December 06, 2023 02:17 PM
From: Art Kagel
Subject: Updated utils2_ak package available
That one is really strange Dennis. The line in question is not defining/declaring malloc but rather defining __alloca to be replaced by malloc. The argument list should be correct anyway in the call at the top of exchange(). Maybe try removing the space between __alloca and the argument list, though that shouldn't make any differencce.
Why did you need to replace getopt.h with unistd.h? The getiopt.h header is included in the package. Which utility was compiling at this point?
Art
------------------------------
Art S. Kagel, President and Principal Consultant
ASK Database Management Corp.
www.askdbmgt.com
Original Message:
Sent: Wed December 06, 2023 12:33 PM
From: Dennis Melnikov
Subject: Updated utils2_ak package available
Art,
Building the package on AIX 7.1 with GNU make and gcc I got the following warnings:
getopt.c: In function 'exchange':
getopt.c:106:27: warning: incompatible implicit declaration of built-in function 'malloc' [enabled by default]
#define __alloca malloc
^
getopt.c:274:27: note: in expansion of macro '__alloca'
char **temp = (char **) __alloca (nonopts_size);
^
Also, I had to replace <getopt.h> with <unistd.h>.
------------------------------
Sincerely,
Dennis
Original Message:
Sent: Fri November 24, 2023 01:07 PM
From: Art Kagel
Subject: Updated utils2_ak package available
Folks:
I have uploaded updates to myschema and dostats_ng.ec included in the latest utils2_ak.zip package. Here are the changes:
Added version & copyright to the verbose 2+ output in dostats. Thanks to Chris Karsten for the suggestion.
Myschema: Fixed the reported length of LVARCHAR type columns when the multibyte flag is set.
Fixed routine parameter lists in GRANT and REVOKE statements for stored routines that contain complex
parameters. Thanks to Davorin Kremenjas for reporting these issues.
------------------------------
Art S. Kagel, President and Principal Consultant
ASK Database Management Corp.
www.askdbmgt.com
------------------------------