*BSD News Article 82044


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!news.Hawaii.Edu!news.uoregon.edu!news.texoma.com!www.nntp.primenet.com!nntp.primenet.com!newspump.sol.net!howland.erols.net!feed1.news.erols.com!super.zippo.com!zdc!szdc!szdc-e!news
From: Mana Bando <mana@nirvanatech.com>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Portability Poblem
Date: Thu, 31 Oct 1996 10:26:24 -0800
Organization: nirvanatech
Lines: 52
Message-ID: <3278EF50.6D12@nirvanatech.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.01 (Win16; U)

Hi folks,

I have some peculiar prob...recently I have been assigned to convert and 
compile a 'C' program from BSD to AIX 4.1.2.  I am not sure what version of 
FreeBSD the program came from but the name of the program is 'strings.c'.  
Anyway, the problem I am facing now is when I am trying to compile under AIX 
I am getting the specific error on 'EXEC' and 'N_BADMAG' and 'N_TXTOFF'.  
Looks like these components must have been included in the BSD header file 
which obviously does not exactly match with AIX header files, despite their 
same name.  Last couple of days I am trying to find which particular header 
file I need to look for or what is the value of these variable in both 
sides. But failed to determine so far. This 'strings.c' program contains the 
following header files.  Any form of help will greatly appreciate.

Mana (mana@nirvanatech.com ......(404)250.1575)

strings.c
.
.
.

#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
#include <a.out.h>
#include <unistd.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>   
.
.
.
typedef struct
               {
                char   exec[200];
               } EXEC;          /* struct exec cast */ 
.
.
.
if (head_len == sizeof(EXEC) && !N_BADMAG(*head))
                              {
                                foff = N_TXTOFF(*head);
                                if (fseek(stdin, foff, SEEK_SET) == -1)
                                        DO_EVERYTHING()
                                read_len = head->a_text + head->a_data;
                                head_len = 0;
                              }
.
.
.
.