Path: news.mitre.org!blanket.mitre.org!philabs!newsjunkie.ans.net!newsfeeds.ans.net!news-was.dfn.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntprelay.mathworks.com!news.mathworks.com!mvb.saic.com!info-vax
From: "Richard B. Gilbert" <76702.1567@compuserve.com>
Newsgroups: comp.os.vms
Subject: modify C code to compile on VMS
Message-ID: <199712061342_MC2-2AF0-FA5B@compuserve.com>
Date: Sat, 6 Dec 1997 13:39:44 -0500
Organization: Info-Vax<==>Comp.Os.Vms Gateway
X-Gateway-Source-Info: Mailing List
Lines: 130

	helbig@multivac.jb.man.ac.uk (Phillip Helbig)  Writes:

>I have DEC C V5.5-002 on OpenVMS Alpha V7.1 and would like to compile
>the code after my .sig (which decodes binhex stuff) on my machine
>(ALPHAstation 255/233).  As I know next to nothing about C, perhaps 
>someone would be so kind to post a corrected version (preferably 
>formatted so that DIFFERENCES will show just the changes).  Considering 
>the thread recently about various encoding `standards' I'm sure this 
>will be of interest to others as well.
>
>I do read the newsgroup EVERY DAY as I'm sure the regulars know, but in
>this case I would appreciate an emailed response as well, as tomorrow 
>there will be network interruptions until the beginning of next week, 
>and I need to decode some stuff from a Macintosh this weekend.  Of 
>course, please post to the newsgroup as well.

<code omitted>

	Here is the output of DIFF /SLP  HQX.C;1 HQX.C;18.  The
revised version gives me a clean compile with:
$ CC /STANDARD=ANSI89 /PREFIX=ALL HQX.C

	I am not a Mac person and have no binhex files on hand to test it
with.

	I hope it helps.  Basically, I added some needed header files and
a bunch of function prototypes.  I also fixed one or two variable type
mismatches.
===================================HQX.DIF=====================================
-    7,   12
#endif

#include <stdio.h>
#include <stdlib.h>		/* exit() */
#include <string.h>		/* strlen(), strncpy(), strncmp() */
#include <unixio.h>		/* create(), close() */
#include <sys/types.h>
#include <sys/stat.h>
</*#include <sys/dir.h>*/

</* Function prototypes */
void setup_files(char *filename, char *macname);
void print_header(void);
void process_forks(void);
void forge_info(void);
int find_header(void);
void do_q_fork(char *fname, register long len);
void do_q_header(char *macname);
void do_o_forks(void);
void put2(char *bp, short value);
void put4(char *bp, long value);
void q_init(void);
void do_o_header(char *macname, char *filename);
int getq(void);
void comp_q_crc(register unsigned int c);
void verify_crc(unsigned int calc_crc, unsigned int file_crc);
int main(int ac, char **av);
int getqbuf(char *buf, int n);
int getq_nocrc(void);
int getq_raw(void);
int get6bits(void);
int comp_to_bin(char ibuf[], FILE *outf);
int hex_to_bin(char ibuf[], FILE *outf);
int hexit(int c);
void comp_e_crc(unsigned char c);


-   17,   17
</* #define FNAMELEN DIRSIZ */
#define FNAMELEN 39	/* Wild ass guess for VMS */
-   27,   27
</* extern long timezone; */
long timezone=0;		/* No quick and easy way to get a value */
-  113,  114
int main(int ac, char **av)
-  184,  184
void setup_files(filename, macname)
-  257,  257
void print_header(void)
-  274,  274
void process_forks(void)
-  286,  286
void forge_info(void)
-  292,  292
        long tdiff = 0;		/* Initialize */
-  297,  297
        unsigned long bs;
-  344,  344
int find_header(void)
-  388,  388
void do_q_header(macname)
-  423,  423
void do_q_fork(fname, len)
-  457,  457
void verify_crc(calc_crc, file_crc)
-  476,  476
void q_init(void)
-  515,  517
int getqbuf(buf, n)
char *buf;
int n;
-  532,  532
int getq(void)
-  542,  542
int getq_nocrc(void)
-  574,  574
int getq_raw(void)
-  624,  624
int get6bits(void)
-  652,  652
void comp_q_crc(c)
-  669,  669
void do_o_header(macname, filename)
-  717,  717
void do_o_forks(void)
-  804,  805
void comp_e_crc(unsigned char c)
-  812,  814
int comp_to_bin(char ibuf[], FILE *outf)
-  845,  847
int hex_to_bin(char ibuf[], FILE *outf)
-  863,  864
int hexit(int c)
-  876,  878
void put2(char *bp, short value)
-  884,  886
void put4(char *bp, long value)
-  894
}
/
