Below is the C code with my interpretations to complete
a test program. So far, it seems to work ok for me (MPE 6.0 pp2).
What MPE version are you on?
Can you give a sample input and output filenames?
What is the file equation options if FILE is used?
-----------------------------------------------------------------
#pragma list off
#define _MPEXL_SOURCE
#define _POSIX_SOURCE
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <mpe.h>
#include <unistd.h>
#pragma intrinsic FOPEN
#pragma intrinsic FCLOSE
#pragma intrinsic FCHECK
#pragma intrinsic FREAD
int main ( int argc, char* argv [] ){
short fs;
int c, page_width, page_depth, cc, infileno;
char infile [30], outfile [30], buf [256];
foptions f;
aoptions a;
FILE *outfilef;
while ((c = getopt(argc, argv, "i:o:p")) != EOF ){
switch (c){
case 'i':
strcpy(infile, optarg);
break;
case 'o':
strcpy(outfile, optarg);
break;
case 'p':
page_width = 612.0;
page_depth = 732.0;
break;
}
}
if (strlen(outfile) == 0){
strcpy(outfile, "PD");
strcpy(outfile+2, infile+2);
}
f.fv = 0;
a.av = 0;
f.fs.domain = 3;
f.fs.ascii = 1;
f.fs.designator = 0;
f.fs.format = 0;
f.fs.carriage = 0;
f.fs.label = 0;
f.fs.no_f_equ = 0;
f.fs.type = 0;
a.as.copy = 0;
a.as.access = 0;
infileno = FOPEN (infile, f.fv, a.av, -133);
cc=ccode();
if(cc != CCE){
FCHECK(infileno, &fs);
fprintf(stderr,"Error opening %s (%o)\n", infile, fs);
exit(1);
}
outfilef=fopen(outfile,"w+ Bs");
/* "w Bs Df1" "a+ Bs Df1" ... */
if (outfilef==NULL){
fprintf(stderr,"Error opening %s\n", outfile);
exit(1);
}
memset ( buf, 0, sizeof (buf));
cc = FREAD ( infileno, buf, -130 );
buf [cc] = 0;
for ( fs = 0; fs < 3; ++fs ){
fprintf ( outfilef, "%s\n", buf );
}
if ( fclose (outfilef)){
fprintf(stderr,"error %d closing %s\n", errno, outfile);
if (errno==ESYSERR){
fprintf(stderr, " intrinsic %d, MPE error %d\n",
_mpe_intrinsic, _mpe_errno);
}
}
FCLOSE (infileno, 0, 0);
}
-----------------------------------------------------------------
/showvar CCOPTS
CCOPTS = -Aa -C +w1
/ccxllk kevc,kev
TUE OCT 22 2002 1:16 PM Copyright Hewlett-Packard Co. 1984. PAGE 1
HP C/iX HP31506 A.06.04 "KEVC"
1 0 # 1 "KEVC.PUB.EAM"
1 0 #pragma list off
END OF COMPILE
HP Link Editor/iX (HP30315A.06.17) Copyright Hewlett-Packard Co 1986
LinkEd> link from=$oldpass;rl=libcshr.lib.sys,libcansi.lib.sys,libmansi.lib.sys
,libcrand.lib.sys;to=kev;share
END OF LINK
/purge pdvc
/kev "-i kevc"
/:L pdvc
TUE, OCT 22, 2002, 1:19 PM
ACCOUNT= EAM GROUP= PUB
FILENAME CODE ------------LOGICAL RECORD----------- ----SPACE----
SIZE TYP EOF LIMIT R/B SECTORS #X MX
PDVC 1B BA 243 4095 1 16 1 8
/l pdvc
1 #pragma list off
2 #pragma list off
3 #pragma list off
/
___________________________________________________________________
Keven Miller mailto:[log in to unmask] http://www.exegesys.com
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|