source: trunk/athena/bin/discuss/client/output.c @ 12459

Revision 12459, 2.8 KB checked in by danw, 26 years ago (diff)
comment out text after #else and #endif
Line 
1/*
2 *
3 *    Copyright (C) 1989 by the Massachusetts Institute of Technology
4 *    Developed by the MIT Student Information Processing Board (SIPB).
5 *    For copying information, see the file mit-copyright.h in this release.
6 *
7 */
8/*
9 *      $Id: output.c,v 1.16 1999-02-08 14:46:51 danw Exp $
10 *
11 *      Utility routines.
12 *
13 */
14
15#ifndef lint
16static char rcsid_discuss_utils_c[] =
17    "$Id: output.c,v 1.16 1999-02-08 14:46:51 danw Exp $";
18#endif /* lint */
19
20#include <stdio.h>
21#include <sys/file.h>
22#include <string.h>
23#include <signal.h>
24#include <ss/ss.h>
25#include <discuss/discuss.h>
26#include "config.h"
27#include "globals.h"
28
29extern ss_request_table discuss_cmds;
30extern char *temp_file;
31extern char *pgm;
32extern char *malloc(), *getenv(), *short_time();
33
34output_trans(tinfop, tf, code)
35        trn_info3 *tinfop;
36        tfile tf;
37        int *code;
38{
39        char *plural;
40        char newtime[26];
41        char line[255];
42        int flagged;
43
44        if (*code != 0) return;
45
46        (void) strcpy (newtime, short_time (&tinfop->date_entered));
47        newtime [24] = '\0';                    /* get rid of \n */
48
49        if (tinfop->num_lines != 1)
50                plural = "s";
51        else
52                plural = "";
53     
54        if (tinfop -> signature != NULL && *(tinfop -> signature) != '\0' &&
55             strcmp(tinfop -> signature, tinfop->author)) {
56             (void) sprintf (line, "[%04d] %s (%s)  %s  %s (%d line%s)\n",
57                             tinfop->current, tinfop->author,
58                              tinfop->signature, dsc_public.m_info.long_name,
59                             newtime, tinfop->num_lines, plural);
60        } else {
61             (void) sprintf (line, "[%04d] %s  %s  %s (%d line%s)\n",
62                             tinfop->current, tinfop->author,
63                             dsc_public.m_info.long_name,
64                             newtime, tinfop->num_lines, plural);
65        }
66        twrite (tf, line, strlen (line), code);
67        if (tinfop->subject [0] != '\0') {
68                twrite (tf, "Subject: ", 9, code);
69                twrite (tf, tinfop->subject, strlen (tinfop->subject), code);
70                twrite (tf, "\n", 1, code);
71        }
72        dsc_get_trn(&dsc_public.nb, tinfop->current, tf, code);
73        if (*code != 0) return;
74
75        /* Force a NL in case the transaction doesn't have one.
76           Tfile's now have Control operations that allow us to
77           do this */
78        tcontrol(tf, TFC_FORCE_NL, 0, code);
79
80        flagged = (tinfop->flags & TRN_FLAG1) != 0;
81        if (tinfop->pref == 0 && tinfop->nref == 0)
82                (void) sprintf (line, "--[%04d]--%s\n\f\n", tinfop->current,
83                                flagged ? " (flagged)" : "");
84        else if (tinfop->pref == 0)
85                (void) sprintf (line, "--[%04d]-- (nref = [%04d]%s)\n\f\n",
86                                tinfop->current, tinfop->nref,
87                                flagged ? ", flagged" : "");
88        else if (tinfop->nref == 0)
89                (void) sprintf (line, "--[%04d]-- (pref = [%04d]%s)\n\f\n",
90                                tinfop->current, tinfop->pref,
91                                flagged ? ", flagged" : "");
92        else
93             (void) sprintf (line,
94                             "--[%04d]-- (pref = [%04d], nref = [%04d]%s)\n\f\n",
95                             tinfop->current, tinfop->pref, tinfop->nref,
96                             flagged ? ", flagged" : "");
97        twrite (tf, line, strlen (line), code);
98}
Note: See TracBrowser for help on using the repository browser.