Unix Technical Forum

C prg issue in Aix

This is a discussion on C prg issue in Aix within the Informix forums, part of the Database Server Software category; --> This message is in MIME format. Since your mail reader does not understand this format, some or all of ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 08:39 PM
hiten.bhawsar
 
Posts: n/a
Default C prg issue in Aix


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01C3BEF2.AE0F7EC0
Content-Type: text/plain;
charset="iso-8859-1"

Hi

Currently we change the OS to AIX
we have c prg to complie

<<msgflash.c>> <<fgiusr.c>> <<store_to_file.c>>

When I complie with

fglgo fgiusr.c msgflash.c store_to_file.c connect.c sendpcmsg.c sendipc.c
c_power.c dbputenv.c change_dir.c err_hand.c get_conn.c recvdssmsg.c
recvpcmsg.c senddssmsg.c prnchk.c AddDevnagri.c cprint.c sockipc.c -o
newfglgo

msgflash.c:
"/usr/informix/incl/tools/sqlfm.h", line 194.16: 1506-277 (S) Syntax error:
poss
ible missing ';' or ','?
store_to_file.c:
"store_to_file.c", line 44.26: 1506-280 (W) Function argument assignment
between
types "struct {...}*" and "int" is not allowed.
connect.c:

Two file error !!




Regard
Hiten



------_=_NextPart_000_01C3BEF2.AE0F7EC0
Content-Type: application/octet-stream;
name="msgflash.c"
Content-Disposition: attachment;
filename="msgflash.c"

/* all terminal types to be taken into account */
#include <curses.h>
#include <fglsys.h>
/*#include <fglsys.h>*/
#include <term.h>
#include<ctype.h>
#include <utmp.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <stdlib.h>
#define SAVECUR "\0337"
#define RESTCUR "\0338"
#define REVERSE "\033[7m"
#define NORMAL "\033[m"
#define CURADD "\033[23;0H"
#define BELL "\007"
#define SIZE 200
#define LINESIZE 80
#define UNAMESIZE 8
int msg_flash(int nargs)
{
FILE *f1;
int i;
char nulc = '\0';
char uname[9];
char msg_hdr[LINESIZE + 1];
char msg_str[SIZE];
struct utmp *getinfo;
char ut_device[40];
for (i=0;i<100;i++) msg_str[i] = nulc;
popstring(uname,UNAMESIZE);
popstring(msg_hdr,LINESIZE);
uname[8] = '\0';
sprintf(msg_str,"%s%s%s%s%s%s%s",SAVECUR,REVERSE,C URADD,
msg_hdr,NORMAL,BELL,RESTCUR);
if (strcmp(uname,"console")==0){
strcpy(ut_device,"/dev/");
strcat(ut_device,uname);
f1 = fopen(ut_device,"w+");
if (f1 == NULL) {
retint(-1);
return(1);
}
fwrite(msg_str,SIZE,1,f1);
fclose(f1);
retint(0);
return(1);
}
setutent();
getinfo =(struct utmp *) malloc(sizeof(struct utmp));
getinfo = getutent();
while (getinfo != NULL){
if ((strcmp(getinfo->ut_user,uname)==0)&&
(getinfo->ut_type != 8)){
strcpy(ut_device,"/dev/");
strcat(ut_device,getinfo->ut_line);
f1 = fopen(ut_device,"w+");
if (f1 == NULL ) {
getinfo = getutent();
continue;
}
break;
}
getinfo = getutent();
}
if (getinfo == NULL)
{
retint(-1);
}
else
{
fwrite(msg_str,strlen(msg_str),1,f1);
fclose(f1);
retint(0);
}
free(getinfo);
return(1);
}


------_=_NextPart_000_01C3BEF2.AE0F7EC0
Content-Type: application/octet-stream;
name="fgiusr.c"
Content-Disposition: attachment;
filename="fgiusr.c"

/************************************************** *************************
*
* INFORMIX SOFTWARE, INC.
*
* PROPRIETARY DATA
*
* THIS DOCUMENT CONTAINS TRADE SECRET DATA WHICH IS THE PROPERTY OF
* INFORMIX SOFTWARE, INC. THIS DOCUMENT IS SUBMITTED TO RECIPIENT IN
* CONFIDENCE. INFORMATION CONTAINED HEREIN MAY NOT BE USED, COPIED OR
* DISCLOSED IN WHOLE OR IN PART EXCEPT AS PERMITTED BY WRITTEN AGREEMENT
* SIGNED BY AN OFFICER OF INFORMIX SOFTWARE, INC.
*
* THIS MATERIAL IS ALSO COPYRIGHTED AS AN UNPUBLISHED WORK UNDER
* SECTIONS 104 AND 408 OF TITLE 17 OF THE UNITED STATES CODE.
* UNAUTHORIZED USE, COPYING OR OTHER REPRODUCTION IS PROHIBITED BY LAW.
*
*
* Title: fgiusr.c
* Sccsid: @(#)fgiusr.c 8.1.1.1 7/23/91 17:46:23
* Description:
* definition of user C functions
*
************************************************** *************************
*/

/************************************************** *************************
*
* This table is for user-defined C functions.
*
* Each initializer has the form:
*
* "name", name, nargs,
*
* Variable # of arguments:
*
* set nargs to -(maximum # args)
*
* Be sure to declare name before the table and to leave the
* line of 0's at the end of the table.
*
* Example:
*
* You want to call your C function named "mycfunc" and it expects
* 2 arguments. You must declare it:
*
* int mycfunc();
*
* and then insert an initializer for it in the table:
*
* "mycfunc", mycfunc, 2,
*
************************************************** *************************
*/

#include "fgicfunc.h"

int sendipc();
int sockipc();
int sendpcmsg();
int msg_flash();
int connect_default();
int connect_dbase_by_name();
int connect_dbase_by_name_user();
int connect_default_wct();
int connect_dbase_by_name_wct();
int connect_dbase_by_name_user_wct();
int disconnect_current();
int disconnect_default();
int disconnect_by_name();
int set_connection_default();
int set_connection_by_name();
int popstring();
int c_power();
int dbputenv();
int change_dir();
int fgl_getpid();
int openfile();
int closefile();
int readfile();
int writefile();
int senddssmsg();
int recvdssmsg();
int save_status();
int get_err_status();
int reset_err_status();
int save_sqlca();
int get_err_sqlcode();
int reset_err_sqlcode();
int get_conn();
int prn_chk_main();
int adddevnagri();
int MakeMsgQueue();
int store_to_file();

cfunc_t usrcfuncs[] =
{
"sendipc", sendipc, 0,
"sockipc", sockipc, 1,
"sendpcmsg", sendpcmsg, 0,
"connect_default", connect_default, 0,
"connect_dbase_by_name", connect_dbase_by_name, 2,
"connect_dbase_by_name_user", connect_dbase_by_name_user, 4,
"connect_default_wct", connect_default_wct, 0,
"connect_dbase_by_name_wct", connect_dbase_by_name_wct, 2,
"connect_dbase_by_name_user_wct", connect_dbase_by_name_user_wct, 4,
"disconnect_current", disconnect_current, 0,
"disconnect_default", disconnect_default, 0,
"disconnect_by_name", disconnect_by_name, 1,
"set_connection_default", set_connection_default, 0,
"set_connection_by_name", set_connection_by_name, 1,
"msg_flash", msg_flash, 2,
"popstring", popstring, 2,
"c_power", c_power, 2,
"dbputenv", dbputenv, 1,
"change_dir", change_dir, 1,
"fgl_getpid", fgl_getpid, 0,
"openfile", openfile, 3,
"readfile", readfile, 2,
"writefile", writefile, 3,
"closefile", closefile, 1,
"senddssmsg", senddssmsg, 0,
"recvdssmsg", recvdssmsg, 0,
"save_status", save_status, 1,
"get_err_status", get_err_status, 0,
"reset_err_status", reset_err_status, 0,
"save_sqlca", save_sqlca, 0,
"get_err_sqlcode", get_err_sqlcode, 0,
"reset_err_sqlcode", reset_err_sqlcode, 0,
"get_conn", get_conn, 0,
"prn_chk_main", prn_chk_main, 0,
"adddevnagri",adddevnagri,15,
"MakeMsgQueue",MakeMsgQueue,0,
"store_to_file",store_to_file,2,
0,0,0
};

------_=_NextPart_000_01C3BEF2.AE0F7EC0
Content-Type: application/octet-stream;
name="store_to_file.c"
Content-Disposition: attachment;
filename="store_to_file.c"

#include <stdio.h>
#include <fglsys.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int store_to_file(nargs)
{
FILE *of_ptr;
int fp;
int nargs;
char p_str_store[700];
char filename[50];
char p_user_id[12];
int ret;
int len;
/* Get the Parameters into the Variables
Variables passed from 4GL Function are received in the reverse order */
popstring(filename,sizeof(filename));
popstring(p_str_store,sizeof(p_str_store));
strcat(p_str_store,"\n");
len = strlen(p_str_store);
/* strcpy(filename,"/usr1/krcl/log/ticket.out"); */
if ((fp= open (filename,O_RDWR | O_CREAT | O_SYNC |O_APPEND,0666))== -1 )
{
fprintf (stderr, "Cannot Open file %s\r\n", filename);
retint(0);
return(1);
}

ret = write(fp,p_str_store,len);
if (ret == -1)
{
fprintf (stderr, "Error In writing to the file %s\r\n", filename);
retint(0);
return(1);
}
system("sync;sync");
close(fp);
if (fclose(fp) != 0 )
{
fprintf (stderr, "Error In closing the file %s\r\n", filename);
retint(0);
return(1);
}
retint(1);
return(1);
}


------_=_NextPart_000_01C3BEF2.AE0F7EC0--
sending to informix-list
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 08:40 PM
Jonathan Leffler
 
Posts: n/a
Default Re: C prg issue in Aix

hiten.bhawsar wrote:

> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
>
> ------_=_NextPart_000_01C3BEF2.AE0F7EC0
> Content-Type: text/plain;
> charset="iso-8859-1"
>
> Hi
>
> Currently we change the OS to AIX
> we have c prg to complie
>
> <<msgflash.c>> <<fgiusr.c>> <<store_to_file.c>>
>
> When I complie with
>
> fglgo fgiusr.c msgflash.c store_to_file.c connect.c sendpcmsg.c sendipc.c
> c_power.c dbputenv.c change_dir.c err_hand.c get_conn.c recvdssmsg.c
> recvpcmsg.c senddssmsg.c prnchk.c AddDevnagri.c cprint.c sockipc.c -o
> newfglgo
>
> msgflash.c:
> "/usr/informix/incl/tools/sqlfm.h", line 194.16: 1506-277 (S) Syntax error:
> poss
> ible missing ';' or ','?
> store_to_file.c:
> "store_to_file.c", line 44.26: 1506-280 (W) Function argument assignment
> between
> types "struct {...}*" and "int" is not allowed.
> connect.c:
>
> Two file error !!


The problem is in sqlfm.h - so the question is what's at line 194 in
that file. Then we'd have to find out what you're doing wrong.

Gut feel - there is a #define in your curses.h file which is
conflicting with someting in the I4GL-RDS sqlfm.h file (included via
fglsys.h). The curses library used by I4GL is totally different from
the one provided by the system (for various bad historical reasons),
so any interworking of I4GL with native C curses has to be done
extremely carefully - and I probably wouldn't try. I'd make do with
what's in the I4GL library. I'd worry a lot!

> name="msgflash.c"
> Content-Disposition: attachment;
> filename="msgflash.c"
>
> /* all terminal types to be taken into account */
> #include <curses.h>
> #include <fglsys.h>
> /*#include <fglsys.h>*/
> #include <term.h>
> #include<ctype.h>
> #include <utmp.h>
> #include <stdio.h>
> #include <string.h>
> #include <fcntl.h>
> #include <stdlib.h>



--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:45 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com