/*****************************************************************************/
/* LibreDWG - free implementation of the DWG file format */
/* */
/* Copyright (C) 2023 Free Software Foundation, Inc. */
/* */
/* This library is free software, licensed under the terms of the GNU */
/* General Public License as published by the Free Software Foundation, */
/* either version 3 of the License, or (at your option) any later version. */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see . */
/*****************************************************************************/
/*
* odaversion.c: prints the ODA compatible DWG version
* modified by Reini Urban
oda understands those versions:
"ACAD9","ACAD10","ACAD12",
"ACAD13","ACAD14",
"ACAD2000","ACAD2004",
"ACAD2007","ACAD2010",
"ACAD2013","ACAD2018"
*/
#include
int
main (int argc, char *argv[])
{
FILE *f;
char buf[7];
size_t size;
if (argc != 2)
return 1;
f = fopen (argv[1], "rb");
if (!f)
return 1;
size = fread (buf, 1, 6, f);
if (size != 6)
return 1;
buf[6] = '\0';
if (buf[0] == 'A' && buf[1] == 'C')
{
int v;
if (1 != sscanf (buf, "AC%4d", &v))
return 1;
if (v < 1004) //