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
RevLine 
[186]1/*
[1927]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/*
[12459]9 *      $Id: output.c,v 1.16 1999-02-08 14:46:51 danw Exp $
[186]10 *
11 *      Utility routines.
12 *
13 */
14
15#ifndef lint
[1608]16static char rcsid_discuss_utils_c[] =
[12459]17    "$Id: output.c,v 1.16 1999-02-08 14:46:51 danw Exp $";
18#endif /* lint */
[186]19
20#include <stdio.h>
21#include <sys/file.h>
[1608]22#include <string.h>
[186]23#include <signal.h>
[8816]24#include <ss/ss.h>
[1633]25#include <discuss/discuss.h>
[186]26#include "config.h"
27#include "globals.h"
28
29extern ss_request_table discuss_cmds;
30extern char *temp_file;
31extern char *pgm;
[599]32extern char *malloc(), *getenv(), *short_time();
[186]33
[1804]34output_trans(tinfop, tf, code)
[2739]35        trn_info3 *tinfop;
[186]36        tfile tf;
37        int *code;
38{
39        char *plural;
40        char newtime[26];
41        char line[255];
[1740]42        int flagged;
[186]43
44        if (*code != 0) return;
45
[1804]46        (void) strcpy (newtime, short_time (&tinfop->date_entered));
[186]47        newtime [24] = '\0';                    /* get rid of \n */
48
[1804]49        if (tinfop->num_lines != 1)
[186]50                plural = "s";
51        else
52                plural = "";
53     
[2739]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        }
[186]66        twrite (tf, line, strlen (line), code);
[1804]67        if (tinfop->subject [0] != '\0') {
[186]68                twrite (tf, "Subject: ", 9, code);
[1804]69                twrite (tf, tinfop->subject, strlen (tinfop->subject), code);
[186]70                twrite (tf, "\n", 1, code);
71        }
[1804]72        dsc_get_trn(&dsc_public.nb, tinfop->current, tf, code);
[186]73        if (*code != 0) return;
74
[616]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
[1804]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,
[1740]83                                flagged ? " (flagged)" : "");
[1804]84        else if (tinfop->pref == 0)
[1740]85                (void) sprintf (line, "--[%04d]-- (nref = [%04d]%s)\n\f\n",
[1804]86                                tinfop->current, tinfop->nref,
[1740]87                                flagged ? ", flagged" : "");
[1804]88        else if (tinfop->nref == 0)
[1740]89                (void) sprintf (line, "--[%04d]-- (pref = [%04d]%s)\n\f\n",
[1804]90                                tinfop->current, tinfop->pref,
[1740]91                                flagged ? ", flagged" : "");
[186]92        else
[599]93             (void) sprintf (line,
[1740]94                             "--[%04d]-- (pref = [%04d], nref = [%04d]%s)\n\f\n",
[1804]95                             tinfop->current, tinfop->pref, tinfop->nref,
[1740]96                             flagged ? ", flagged" : "");
[186]97        twrite (tf, line, strlen (line), code);
98}
Note: See TracBrowser for help on using the repository browser.