Deleted Added
full compact
show.c (213744) show.c (213760)
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

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

31 */
32
33#ifndef lint
34#if 0
35static char sccsid[] = "@(#)show.c 8.3 (Berkeley) 5/4/95";
36#endif
37#endif /* not lint */
38#include <sys/cdefs.h>
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

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

31 */
32
33#ifndef lint
34#if 0
35static char sccsid[] = "@(#)show.c 8.3 (Berkeley) 5/4/95";
36#endif
37#endif /* not lint */
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/bin/sh/show.c 213744 2010-10-12 19:24:41Z obrien $");
39__FBSDID("$FreeBSD: head/bin/sh/show.c 213760 2010-10-13 04:01:01Z obrien $");
40
41#include <fcntl.h>
42#include <stdio.h>
43#include <stdlib.h>
44#include <stdarg.h>
45#include <errno.h>
46
47#include "shell.h"
48#include "parser.h"
49#include "nodes.h"
50#include "mystring.h"
51#include "show.h"
52
53
54#ifdef DEBUG
40
41#include <fcntl.h>
42#include <stdio.h>
43#include <stdlib.h>
44#include <stdarg.h>
45#include <errno.h>
46
47#include "shell.h"
48#include "parser.h"
49#include "nodes.h"
50#include "mystring.h"
51#include "show.h"
52
53
54#ifdef DEBUG
55static void shtree(union node *, int, char *, FILE*);
56static void shcmd(union node *, FILE *);
57static void sharg(union node *, FILE *);
58static void indent(int, char *, FILE *);
59static void trstring(char *);
55STATIC void shtree(union node *, int, char *, FILE*);
56STATIC void shcmd(union node *, FILE *);
57STATIC void sharg(union node *, FILE *);
58STATIC void indent(int, char *, FILE *);
59STATIC void trstring(char *);
60
61
62void
63showtree(union node *n)
64{
65 trputs("showtree called\n");
66 shtree(n, 1, NULL, stdout);
67}
68
69
60
61
62void
63showtree(union node *n)
64{
65 trputs("showtree called\n");
66 shtree(n, 1, NULL, stdout);
67}
68
69
70static void
70STATIC void
71shtree(union node *n, int ind, char *pfx, FILE *fp)
72{
73 struct nodelist *lp;
74 char *s;
75
76 if (n == NULL)
77 return;
78

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

113 if (ind >= 0)
114 putc('\n', fp);
115 break;
116 }
117}
118
119
120
71shtree(union node *n, int ind, char *pfx, FILE *fp)
72{
73 struct nodelist *lp;
74 char *s;
75
76 if (n == NULL)
77 return;
78

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

113 if (ind >= 0)
114 putc('\n', fp);
115 break;
116 }
117}
118
119
120
121static void
121STATIC void
122shcmd(union node *cmd, FILE *fp)
123{
124 union node *np;
125 int first;
126 char *s;
127 int dftfd;
128
129 first = 1;

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

164 sharg(np->nfile.fname, fp);
165 }
166 first = 0;
167 }
168}
169
170
171
122shcmd(union node *cmd, FILE *fp)
123{
124 union node *np;
125 int first;
126 char *s;
127 int dftfd;
128
129 first = 1;

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

164 sharg(np->nfile.fname, fp);
165 }
166 first = 0;
167 }
168}
169
170
171
172static void
172STATIC void
173sharg(union node *arg, FILE *fp)
174{
175 char *p;
176 struct nodelist *bqlist;
177 int subtype;
178
179 if (arg->type != NARG) {
180 printf("<node type %d>\n", arg->type);

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

249 default:
250 putc(*p, fp);
251 break;
252 }
253 }
254}
255
256
173sharg(union node *arg, FILE *fp)
174{
175 char *p;
176 struct nodelist *bqlist;
177 int subtype;
178
179 if (arg->type != NARG) {
180 printf("<node type %d>\n", arg->type);

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

249 default:
250 putc(*p, fp);
251 break;
252 }
253 }
254}
255
256
257static void
257STATIC void
258indent(int amount, char *pfx, FILE *fp)
259{
260 int i;
261
262 for (i = 0 ; i < amount ; i++) {
263 if (pfx && i == amount - 1)
264 fputs(pfx, fp);
265 putc('\t', fp);

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

312 if (tracefile == NULL)
313 return;
314 fputs(s, tracefile);
315 if (strchr(s, '\n'))
316 fflush(tracefile);
317}
318
319
258indent(int amount, char *pfx, FILE *fp)
259{
260 int i;
261
262 for (i = 0 ; i < amount ; i++) {
263 if (pfx && i == amount - 1)
264 fputs(pfx, fp);
265 putc('\t', fp);

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

312 if (tracefile == NULL)
313 return;
314 fputs(s, tracefile);
315 if (strchr(s, '\n'))
316 fflush(tracefile);
317}
318
319
320static void
320STATIC void
321trstring(char *s)
322{
323 char *p;
324 char c;
325
326 if (tracefile == NULL)
327 return;
328 putc('"', tracefile);

--- 80 unchanged lines hidden ---
321trstring(char *s)
322{
323 char *p;
324 char c;
325
326 if (tracefile == NULL)
327 return;
328 putc('"', tracefile);

--- 80 unchanged lines hidden ---