Initial revision
[sw-tools] / src / pres_plain.c
CommitLineData
3315e8b3 1/* -*-c-*-
2 *
3 * $Id: pres_plain.c,v 1.1 1999/06/02 16:53:35 mdw Exp $
4 *
5 * Plain output style for remote builds
6 *
7 * (c) 1999 EBI
8 */
9
10/*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of sw-tools.
13 *
14 * sw-tools is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * sw-tools is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with sw-tools; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 */
28
29/*----- Revision history --------------------------------------------------*
30 *
31 * $Log: pres_plain.c,v $
32 * Revision 1.1 1999/06/02 16:53:35 mdw
33 * Initial revision
34 *
35 */
36
37/*----- Header files ------------------------------------------------------*/
38
39#include <errno.h>
40#include <stdio.h>
41#include <stdlib.h>
42#include <string.h>
43
44#include <mLib/alloc.h>
45#include <mLib/lbuf.h>
46
47#include "sw.h"
48#include "sw_arch.h"
49#include "pres_plain.h"
50
51/*----- Main code ---------------------------------------------------------*/
52
53/* --- @line@ --- */
54
55static void line(char *s, void *p)
56{
57 archent *e = p;
58 if (s)
59 printf("%s: %s\n", e->arch, s);
60}
61
62/* --- @plain_init@ --- */
63
64int plain_init(archcons *a)
65{
66 for (; a; a = a->cdr) {
67 archent *e = a->car;
68 lbuf *b;
69 if (!e->r)
70 continue;
71 b = xmalloc(sizeof(lbuf));
72 e->pres = b;
73 lbuf_init(b, line, e);
74 }
75 return (0);
76}
77
78/* --- @plain_output@ --- */
79
80void plain_output(archent *e, const char *p, size_t sz)
81{
82 lbuf_snarf(e->pres, p, sz);
83}
84
85/* --- @plain_close@ --- */
86
87void plain_close(archent *e, int ok)
88{
89 lbuf_close(e->pres);
90}
91
92/* --- @plain_done@ --- */
93
94void plain_done(archcons *a)
95{
96 for (; a; a = a->cdr) {
97 if (!a->car->r)
98 continue;
99 free(a->car->pres);
100 }
101 if (opt_flags & optFlag_beep)
102 putchar('\a');
103}
104
105/*----- That's all, folks -------------------------------------------------*/