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 | * |
---|
10 | * catchup request for DISCUSS |
---|
11 | * |
---|
12 | * $Id: catchup.c,v 1.8 1999-02-08 14:46:46 danw Exp $ |
---|
13 | * |
---|
14 | */ |
---|
15 | #ifndef lint |
---|
16 | static char rcsid_discuss_c[] = |
---|
17 | "$Id: catchup.c,v 1.8 1999-02-08 14:46:46 danw Exp $"; |
---|
18 | #endif /* lint */ |
---|
19 | |
---|
20 | #include <stdio.h> |
---|
21 | #include <string.h> |
---|
22 | #include <discuss/discuss.h> |
---|
23 | #include <ss/ss.h> |
---|
24 | #include "config.h" |
---|
25 | #include "globals.h" |
---|
26 | |
---|
27 | catchup(argc, argv) |
---|
28 | int argc; |
---|
29 | char **argv; |
---|
30 | { |
---|
31 | int code; |
---|
32 | |
---|
33 | if (!dsc_public.attending) { |
---|
34 | ss_perror(sci_idx, 0, "No current meeting.\n"); |
---|
35 | return; |
---|
36 | } |
---|
37 | dsc_destroy_mtg_info(&dsc_public.m_info); |
---|
38 | dsc_get_mtg_info(&dsc_public.nb, |
---|
39 | &dsc_public.m_info, &code); |
---|
40 | if (code != 0) { |
---|
41 | (void) ss_perror(sci_idx, code, "Can't get meeting info"); |
---|
42 | return; |
---|
43 | } |
---|
44 | |
---|
45 | dsc_public.highest_seen = dsc_public.m_info.highest; |
---|
46 | dsc_public.current = dsc_public.highest_seen; |
---|
47 | } |
---|
48 | |
---|
49 | set_seen(argc, argv) |
---|
50 | int argc; |
---|
51 | char **argv; |
---|
52 | { |
---|
53 | int code; |
---|
54 | trn_nums set_trn; |
---|
55 | selection_list *trn_list; |
---|
56 | trn_info t_info; |
---|
57 | |
---|
58 | if (argc != 2) { |
---|
59 | fprintf(stderr, "Usage: set seen <transaction>\n"); |
---|
60 | return; |
---|
61 | } |
---|
62 | |
---|
63 | if (!dsc_public.attending) { |
---|
64 | ss_perror(sci_idx, 0, "No current meeting.\n"); |
---|
65 | return; |
---|
66 | } |
---|
67 | |
---|
68 | dsc_destroy_mtg_info(&dsc_public.m_info); |
---|
69 | dsc_get_mtg_info(&dsc_public.nb, &dsc_public.m_info, &code); |
---|
70 | if (code != 0) { |
---|
71 | (void) ss_perror(sci_idx, code, "Can't get meeting info"); |
---|
72 | return; |
---|
73 | } |
---|
74 | |
---|
75 | dsc_get_trn_info(&dsc_public.nb, dsc_public.current, &t_info, &code); |
---|
76 | if (code != 0) |
---|
77 | t_info.current = 0; |
---|
78 | dsc_destroy_trn_info(&t_info); |
---|
79 | |
---|
80 | trn_list = trn_select(&t_info, argv[1], |
---|
81 | (selection_list *)NULL, &code); |
---|
82 | if (code) { |
---|
83 | ss_perror(sci_idx, code, ""); |
---|
84 | sl_free(trn_list); |
---|
85 | return; |
---|
86 | } |
---|
87 | |
---|
88 | if (trn_list -> low != trn_list -> high) { |
---|
89 | ss_perror(sci_idx, 0, "Cannot set seen to range"); |
---|
90 | sl_free(trn_list); |
---|
91 | return; |
---|
92 | } |
---|
93 | |
---|
94 | set_trn = trn_list -> low; |
---|
95 | sl_free(trn_list); |
---|
96 | |
---|
97 | dsc_public.highest_seen = set_trn; |
---|
98 | dsc_public.current = dsc_public.highest_seen; |
---|
99 | } |
---|