Deleted Added
full compact
show.c (18018) show.c (20425)
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 19 unchanged lines hidden (view full) ---

28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 19 unchanged lines hidden (view full) ---

28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * $Id: show.c,v 1.3 1996/09/01 10:21:43 peter Exp $
36 * $Id: show.c,v 1.4 1996/09/03 14:16:00 peter Exp $
37 */
38
39#ifndef lint
37 */
38
39#ifndef lint
40static char sccsid[] = "@(#)show.c 8.3 (Berkeley) 5/4/95";
40static char const sccsid[] = "@(#)show.c 8.3 (Berkeley) 5/4/95";
41#endif /* not lint */
42
43#include <stdio.h>
44#if __STDC__
45#include <stdarg.h>
46#else
47#include <varargs.h>
48#endif

--- 215 unchanged lines hidden (view full) ---

264 int i;
265
266 for (i = 0 ; i < amount ; i++) {
267 if (pfx && i == amount - 1)
268 fputs(pfx, fp);
269 putc('\t', fp);
270 }
271}
41#endif /* not lint */
42
43#include <stdio.h>
44#if __STDC__
45#include <stdarg.h>
46#else
47#include <varargs.h>
48#endif

--- 215 unchanged lines hidden (view full) ---

264 int i;
265
266 for (i = 0 ; i < amount ; i++) {
267 if (pfx && i == amount - 1)
268 fputs(pfx, fp);
269 putc('\t', fp);
270 }
271}
272#endif
273
274
272
273
275
276/*
277 * Debugging stuff.
278 */
279
280
281FILE *tracefile;
282
283#if DEBUG == 2
284int debug = 1;
285#else
286int debug = 0;
287#endif
288
289
290void
274/*
275 * Debugging stuff.
276 */
277
278
279FILE *tracefile;
280
281#if DEBUG == 2
282int debug = 1;
283#else
284int debug = 0;
285#endif
286
287
288void
291trputc(c)
289trputc(c)
292 int c;
293{
290 int c;
291{
294#ifdef DEBUG
295 if (tracefile == NULL)
296 return;
297 putc(c, tracefile);
298 if (c == '\n')
299 fflush(tracefile);
292 if (tracefile == NULL)
293 return;
294 putc(c, tracefile);
295 if (c == '\n')
296 fflush(tracefile);
300#endif
301}
302
297}
298
299
303void
304#if __STDC__
300void
301#if __STDC__
305shtrace(const char *fmt, ...)
302trace(const char *fmt, ...)
306#else
303#else
307shtrace(va_alist)
304trace(va_alist)
308 va_dcl
309#endif
310{
305 va_dcl
306#endif
307{
311#ifdef DEBUG
312 va_list va;
313#if __STDC__
314 va_start(va, fmt);
315#else
316 char *fmt;
317 va_start(va);
318 fmt = va_arg(va, char *);
319#endif
320 if (tracefile != NULL) {
321 (void) vfprintf(tracefile, fmt, va);
322 if (strchr(fmt, '\n'))
323 (void) fflush(tracefile);
324 }
325 va_end(va);
308 va_list va;
309#if __STDC__
310 va_start(va, fmt);
311#else
312 char *fmt;
313 va_start(va);
314 fmt = va_arg(va, char *);
315#endif
316 if (tracefile != NULL) {
317 (void) vfprintf(tracefile, fmt, va);
318 if (strchr(fmt, '\n'))
319 (void) fflush(tracefile);
320 }
321 va_end(va);
326#endif
327}
328
329
330void
331trputs(s)
332 char *s;
333{
322}
323
324
325void
326trputs(s)
327 char *s;
328{
334#ifdef DEBUG
335 if (tracefile == NULL)
336 return;
337 fputs(s, tracefile);
338 if (strchr(s, '\n'))
339 fflush(tracefile);
329 if (tracefile == NULL)
330 return;
331 fputs(s, tracefile);
332 if (strchr(s, '\n'))
333 fflush(tracefile);
340#endif
341}
342
343
334}
335
336
344#ifdef DEBUG
345static void
346trstring(s)
347 char *s;
348{
349 register char *p;
350 char c;
351
352 if (tracefile == NULL)

--- 23 unchanged lines hidden (view full) ---

376 putc(*p >> 3 & 07, tracefile);
377 putc(*p & 07, tracefile);
378 }
379 break;
380 }
381 }
382 putc('"', tracefile);
383}
337static void
338trstring(s)
339 char *s;
340{
341 register char *p;
342 char c;
343
344 if (tracefile == NULL)

--- 23 unchanged lines hidden (view full) ---

368 putc(*p >> 3 & 07, tracefile);
369 putc(*p & 07, tracefile);
370 }
371 break;
372 }
373 }
374 putc('"', tracefile);
375}
384#endif
385
386
387void
388trargs(ap)
389 char **ap;
390{
376
377
378void
379trargs(ap)
380 char **ap;
381{
391#ifdef DEBUG
392 if (tracefile == NULL)
393 return;
394 while (*ap) {
395 trstring(*ap++);
396 if (*ap)
397 putc(' ', tracefile);
398 else
399 putc('\n', tracefile);
400 }
401 fflush(tracefile);
382 if (tracefile == NULL)
383 return;
384 while (*ap) {
385 trstring(*ap++);
386 if (*ap)
387 putc(' ', tracefile);
388 else
389 putc('\n', tracefile);
390 }
391 fflush(tracefile);
402#endif
403}
404
405
406void
407opentrace() {
392}
393
394
395void
396opentrace() {
408#ifdef DEBUG
409 char s[100];
410 char *getenv();
411#ifdef O_APPEND
412 int flags;
413#endif
414
415 if (!debug)
416 return;

--- 17 unchanged lines hidden (view full) ---

434 return;
435 }
436#ifdef O_APPEND
437 if ((flags = fcntl(fileno(tracefile), F_GETFL, 0)) >= 0)
438 fcntl(fileno(tracefile), F_SETFL, flags | O_APPEND);
439#endif
440 fputs("\nTracing started.\n", tracefile);
441 fflush(tracefile);
397 char s[100];
398 char *getenv();
399#ifdef O_APPEND
400 int flags;
401#endif
402
403 if (!debug)
404 return;

--- 17 unchanged lines hidden (view full) ---

422 return;
423 }
424#ifdef O_APPEND
425 if ((flags = fcntl(fileno(tracefile), F_GETFL, 0)) >= 0)
426 fcntl(fileno(tracefile), F_SETFL, flags | O_APPEND);
427#endif
428 fputs("\nTracing started.\n", tracefile);
429 fflush(tracefile);
442#endif /* DEBUG */
443}
430}
431#endif /* DEBUG */