source: buchla-68k/orig/GEMDOS/CURVER.C@ 2340de6

Last change on this file since 2340de6 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Imported original source code.

  • Property mode set to 100755
File size: 2.1 KB
Line 
1/*
2 =============================================================================
3 curver.c -- read and print a GEMDOS version message object file
4 Version 1 -- 1988-11-03 -- D.N. Lynx Crowe
5 (c) Copyright 1988 -- D.N. Lynx Crowe -- All rights reserved
6
7 Compiled and linked with the GEMDOS Alcyon C developer's package.
8
9 NOTE: Because we use the Alcyon GEMDOS object file format,
10 which is specific to the Atari, this code is NON-PORTABLE.
11
12 The idea, however, is adaptable to a wide variety of systems
13 and object file formats.
14 =============================================================================
15*/
16
17#include "stdio.h" /* Atari GEMDOS standard I/O definitions */
18#include "stddefs.h" /* some usefull standard C definitions */
19#include "objdefs.h" /* GEMDOS object file definitions */
20
21#define VERFILE "verdate.o" /* version message file */
22
23extern int errno; /* system error code */
24
25FILE *fp; /* VERFILE file pointer */
26
27struct vb { /* VERFILE buffer (66 bytes) */
28
29 struct EXFILE hdr;
30 char ver[12];
31 struct SYMBOL sym;
32 char rem[12];
33
34} verbuf;
35
36/*
37
38*/
39
40/*
41 =============================================================================
42 read and print an Alcyon/GEMDOS format version message object file
43 =============================================================================
44*/
45
46main()
47{
48 short len, rc;
49
50 len = sizeof verbuf;
51
52 /* first, read the version message object file */
53
54 if ((FILE *)NULL EQ (fp = fopenb(VERFILE, "r"))) {
55
56 printf("ERROR -- Unable to open \"%s\" for reading (errno = %d)\n",
57 VERFILE, errno);
58
59 exit(1);
60 }
61
62 rewind(fp);
63
64 if (1 NE (rc = fread(&verbuf, len, 1, fp))) {
65
66 printf("ERROR -- Unable to read \"%s\" (rc = %d, errno = %d)\n",
67 VERFILE, rc, errno);
68
69 if (ferror(fp))
70 printf(" File system ERROR.\n");
71 else if (feof(fp))
72 printf(" Premature EOF.\n");
73 else
74 printf(" Neither ERROR or EOF set -- very odd\n");
75
76 fclose(fp);
77 exit(1);
78 }
79
80 /* close the file, print the version message, and exit */
81
82 fclose(fp);
83 printf("Current version: %s\n", verbuf.ver);
84 exit(0);
85}
Note: See TracBrowser for help on using the repository browser.