1277218Sjfv/* 2277218Sjfv * Copyright (c) 1995 3277218Sjfv * The Regents of the University of California. All rights reserved. 4277218Sjfv * 5277218Sjfv * Redistribution and use in source and binary forms, with or without 6277218Sjfv * modification, are permitted provided that: (1) source code distributions 7277218Sjfv * retain the above copyright notice and this paragraph in its entirety, (2) 8277218Sjfv * distributions including binary code include the above copyright notice and 9277218Sjfv * this paragraph in its entirety in the documentation or other materials 10277218Sjfv * provided with the distribution, and (3) all advertising materials mentioning 11277218Sjfv * features or use of this software display the following acknowledgement: 12277218Sjfv * ``This product includes software developed by the University of California, 13277218Sjfv * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14277218Sjfv * the University nor the names of its contributors may be used to endorse 15277218Sjfv * or promote products derived from this software without specific prior 16277218Sjfv * written permission. 17277218Sjfv * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18277218Sjfv * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19277218Sjfv * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20277218Sjfv */ 21277218Sjfv 22277218Sjfv#ifndef lint 23277218Sjfvstatic const char rcsid[] _U_ = 24277218Sjfv "@(#) $Header: /tcpdump/master/tcpdump/vfprintf.c,v 1.6 2003-11-16 09:36:45 guy Exp $ (LBL)"; 25277218Sjfv#endif 26277218Sjfv 27277218Sjfv#ifdef HAVE_CONFIG_H 28277218Sjfv#include "config.h" 29277218Sjfv#endif 30277218Sjfv 31277218Sjfv#include <sys/types.h> 32277218Sjfv 33277218Sjfv#include <stdio.h> 34285603Sbrueffer#include <stdarg.h> 35277218Sjfv#include <stdlib.h> 36277218Sjfv#include <unistd.h> 37277218Sjfv 38277218Sjfv#include "interface.h" 39277218Sjfv 40277218Sjfv/* 41277218Sjfv * Stock 4.3 doesn't have vfprintf. 42277218Sjfv * This routine is due to Chris Torek. 43277218Sjfv */ 44277218Sjfvvfprintf(f, fmt, args) 45277218Sjfv FILE *f; 46277218Sjfv char *fmt; 47277218Sjfv va_list args; 48277218Sjfv{ 49277218Sjfv int ret; 50277218Sjfv 51277218Sjfv if ((f->_flag & _IOWRT) == 0) { 52277218Sjfv if (f->_flag & _IORW) 53277218Sjfv f->_flag |= _IOWRT; 54277218Sjfv else 55277218Sjfv return EOF; 56277218Sjfv } 57277218Sjfv ret = _doprnt(fmt, args, f); 58277218Sjfv return ferror(f) ? EOF : ret; 59277218Sjfv} 60277218Sjfv