Mercurial > noffle
view src/online.c @ 44:bb6a1bf61279 noffle
[svn] Oops. Forgot three files in my last commit:
* Removed Makefile.
* Added docs/Makefile.am and docs/Makefile.in
author | uh1763 |
---|---|
date | Fri, 05 May 2000 22:50:13 +0100 |
parents | 2842f50feb55 |
children | 32ba1198c6fa |
line wrap: on
line source
/* online.c $Id: online.c 49 2000-05-05 21:45:56Z uh1763 $ */ #if HAVE_CONFIG_H #include <config.h> #endif #include <stdio.h> #include <unistd.h> #include "common.h" #include "configfile.h" #include "log.h" static void fileOnline( Str s ) { snprintf( s, MAXCHAR, "%s/lock/online", Cfg_spoolDir() ); } Bool Online_true( void ) { FILE *f; Str file; fileOnline( file ); if ( ! ( f = fopen( file, "r" ) ) ) return FALSE; fclose( f ); return TRUE; } void Online_set( Bool value ) { FILE *f; Str file; fileOnline( file ); if ( value ) { if ( ! ( f = fopen( file, "a" ) ) ) { Log_err( "Could not create %s", file ); return; } fclose( f ); Log_inf( "NOFFLE is now online" ); } else { if ( unlink( file ) != 0 ) { Log_err( "Cannot remove %s", file ); return; } Log_inf( "NOFFLE is now offline" ); } }