ftp.nice.ch/pub/next/tools/scsi/SCSI2_ToolBox.941207.NI.bs.gnutar.gz#/SCSI2_ToolBox/SCSI2_Kit/Source/errio.c

This is errio.c in view mode; [Download] [Up]

//
//	errio - A variety of functions for outputting formatted
//			error and debugging messages.
//
//	Copyright (C) 1994 by Andreas Ploeger and Christopher Wolf.
//
//	This library is free software; you can redistribute it and/or
//	modify it under the terms of the GNU Library General Public
//	License as published by the Free Software Foundation; either
//	version 2 of the License, or (at your option) any later version.
//
//	This library is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//	Library General Public License for more details.
//
//	You should have received a copy of the GNU Library General Public
//	License along with this library; if not, write to the Free
//	Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//	Bug-reports, comments and questions should be directed to:
//		Christopher Wolf <chris@alchemy.geo.cornell.edu>
//		Andreas Ploeger <ploeger@aplki.toppoint.de>
//

//
// 	For best results view this file with a tab size of 4 and
//	a display width of 132 columns or wider.
//

//	file version information
#define RCSEIM "$Id: errio.c,v 0.1 94/11/17 01:43:05 chris Exp Locker: chris $"

//	generic Unix headers
#import <libc.h>
#import <stdarg.h>
#import <stdio.h>
#import <syslog.h>

//	NeXTSTEP specific headers
#import <appkit/appkit.h>

//	misc headers
#import "errio.h"

//	string constants
const char RCSeim[] = RCSEIM;
const char RCSeih[] = RCSEIH;




//	**********************************************************************
//
//	These functions handle error, debugging and informational messages
//	and output formatted debug and error messages, with a newline appended
//	to various appropriate locations.  They are intended to be used as
//	PrintFunction targets for the setDprintf: function in the SCSI.m
//	class.  See the setDPrintf documentation for further details.
//
//	**********************************************************************


void printfToStderr(const char *fmt, ...)
	{

	va_list args;

  	va_start(args, fmt);
	if ( (vfprintf(stderr, fmt, args) < 0) || (putc('\n', stderr) == EOF) )
		{
		syslog(LOG_ALERT, __FILE__ ": printfToStderr: Can't print error message");
		}		
 	va_end(args);
	
	}


void printfToStdout(const char *fmt, ...)
	{
	
  	va_list args;
	
 	va_start(args, fmt);
  	if ( (vfprintf(stdout, fmt, args) < 0) || (putc('\n', stdout)==EOF) )
		{
    	syslog(LOG_ALERT, __FILE__ ": printfToStdout: Can't print error message");
		}
	va_end(args);
	
	}


void printfToSyslog(const char *fmt, ...)
	{
	
  	va_list args;

  	va_start(args, fmt);  
  	vsyslog(LOG_DEBUG, fmt, args); 
  	va_end(args);

	}


void printfToNull(const char *fmt, ...)
	{	
	}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.