Publish VCC Plus OSS source distribution for 3.6.2 build 60
This commit is contained in:
commit
c652a5276d
1192 files changed
+272368
No files matched your search
@@ -0,0 +1,40 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Compile both ways and link with a third source that uses stdio rewind alone.
|
||||
#ifdef LEGACY_FIRST
|
||||
#include <disk.h>
|
||||
#include <stdio.h>
|
||||
#define CHECK_ORDER checkLegacyFirst
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <disk.h>
|
||||
#define CHECK_ORDER checkStdioFirst
|
||||
#endif
|
||||
|
||||
int CHECK_ORDER(void)
|
||||
{
|
||||
static byte fat[MAX_NUM_GRANULES];
|
||||
static struct FileDesc descriptor;
|
||||
void (*resetDescriptor)(struct FileDesc *) = rewind;
|
||||
void (*resetStream)(FILE *) = vcc_rewind;
|
||||
char bytes[3];
|
||||
FILE *stream;
|
||||
int ok;
|
||||
|
||||
// initdisk installs this source file’s FAT buffer without clearing the cache flag.
|
||||
fatUpToDate = FALSE;
|
||||
if (!initdisk(fat) || !openfile(&descriptor, "SAFE.DAT"))
|
||||
return 1;
|
||||
ok = read(&descriptor, bytes, 3) == 3 && memcmp(bytes, "pre", 3) == 0;
|
||||
resetDescriptor(&descriptor);
|
||||
ok = ok && read(&descriptor, bytes, 3) == 3 && memcmp(bytes, "pre", 3) == 0;
|
||||
if (close(&descriptor) || !ok)
|
||||
return 1;
|
||||
|
||||
stream = fopen("SAFE.DAT", "rb");
|
||||
if (!stream)
|
||||
return 1;
|
||||
ok = fgetc(stream) == 'p' && fgetc(stream) == 'r';
|
||||
resetStream(stream);
|
||||
ok = ok && ftell(stream) == 0L && fgetc(stream) == 'p';
|
||||
return fclose(stream) || !ok;
|
||||
}
|
||||
Reference in new issue
Block a user