Files
magic/utils/LIBdbio.c
T
Tim Edwards 075262b2ef Added the ability to read compressed .mag files (writing is not yet
supported).  Fixed the long-standing issue in which DRC does not
get stopped by the "drc off" command (the behavior for interrupting
the DRC was dependent on the DRC being turned on, and the "drc off"
command was turning it off before breaking, causing the interrupt
to be ignored).
2022-11-02 17:12:46 -04:00

61 lines
1.8 KiB
C

/*
* LIBdbio.c --
*
* File that only goes in libmagicutils.a to define procedures
* referenced from dbio that might not be defined elsewhere.
*
* *********************************************************************
* * Copyright (C) 1985, 1990 Regents of the University of California. *
* * Permission to use, copy, modify, and distribute this *
* * software and its documentation for any purpose and without *
* * fee is hereby granted, provided that the above copyright *
* * notice appear in all copies. The University of California *
* * makes no representations about the suitability of this *
* * software for any purpose. It is provided "as is" without *
* * express or implied warranty. Export of this software outside *
* * of the United States of America may require an export license. *
* *********************************************************************
*/
#ifndef lint
static char rcsid[] = "$Header: /usr/cvsroot/magic-8.0/utils/LIBdbio.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $";
#endif /* not lint */
#include <stdio.h>
#include <unistd.h>
#include "utils/magic.h"
/*
* ----------------------------------------------------------------------------
*
* flock_open
*
* Like standard flock_open, except that it is always called read-only,
* so it simply calls a normal fopen().
*
* Results:
* Returns a pointer to the opened file
*
* Side effects:
* None
*
* ----------------------------------------------------------------------------
*/
FILE *
flock_open(filename, mode, is_locked, fdb)
char *filename;
char *mode;
bool *is_locked;
int *fdb;
{
FILE *f;
if (is_locked) *is_locked = FALSE;
f = fopen(filename, mode);
if ((f >= 0) && (fdb != NULL)) *fdb = fileno(f);
return(f);
}