Expunge revision histories in files.
[sw-tools] / src / pres_plain.c
CommitLineData
3315e8b3 1/* -*-c-*-
2 *
9796a787 3 * $Id: pres_plain.c,v 1.3 2004/04/08 01:52:19 mdw Exp $
3315e8b3 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
3315e8b3 29/*----- Header files ------------------------------------------------------*/
30
31#include <errno.h>
32#include <stdio.h>
33#include <stdlib.h>
34#include <string.h>
35
36#include <mLib/alloc.h>
37#include <mLib/lbuf.h>
38
39#include "sw.h"
40#include "sw_arch.h"
41#include "pres_plain.h"
42
43/*----- Main code ---------------------------------------------------------*/
44
45/* --- @line@ --- */
46
47static void line(char *s, void *p)
48{
49 archent *e = p;
50 if (s)
51 printf("%s: %s\n", e->arch, s);
52}
53
54/* --- @plain_init@ --- */
55
56int plain_init(archcons *a)
57{
58 for (; a; a = a->cdr) {
59 archent *e = a->car;
60 lbuf *b;
61 if (!e->r)
62 continue;
63 b = xmalloc(sizeof(lbuf));
64 e->pres = b;
65 lbuf_init(b, line, e);
66 }
67 return (0);
68}
69
70/* --- @plain_output@ --- */
71
72void plain_output(archent *e, const char *p, size_t sz)
73{
74 lbuf_snarf(e->pres, p, sz);
75}
76
77/* --- @plain_close@ --- */
78
5636c0ce 79void plain_close(archent *e, int ok, const char *summ)
3315e8b3 80{
81 lbuf_close(e->pres);
5636c0ce 82 if (!ok)
83 printf("%s: %s\n", e->arch, summ);
3315e8b3 84}
85
86/* --- @plain_done@ --- */
87
88void plain_done(archcons *a)
89{
90 for (; a; a = a->cdr) {
91 if (!a->car->r)
92 continue;
93 free(a->car->pres);
94 }
95 if (opt_flags & optFlag_beep)
96 putchar('\a');
97}
98
99/*----- That's all, folks -------------------------------------------------*/