source: trunk/athena/bin/discuss/mclient/crmtgs.c @ 23271

Revision 23271, 2.2 KB checked in by broder, 15 years ago (diff)
Add com_err support for delete and discuss on OS X.
Line 
1/*
2 *
3 *      Copyright (C) 1988, 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: crmtgs.c,v 1.7 1999-04-12 16:47:06 ghudson Exp $
10 *
11 *      Fill out a .meetings file with the primary name of all the
12 *      meetings in it.  This requires that the meeting be accessible
13 *      at this time; however, this program may be run several times
14 *      to get it right..
15 *
16 */
17
18#ifndef lint
19static char rcsid_crmtgs_c[] =
20    "$Id: crmtgs.c,v 1.7 1999-04-12 16:47:06 ghudson Exp $";
21#endif /* lint */
22
23#include <stdio.h>
24#include <discuss/discuss.h>
25
26extern char *getenv ();
27
28main(argc, argv)
29        int argc;
30        char **argv;
31{
32        int n_matches, code;
33        register name_blk *nbp;
34        name_blk *set;
35        int i;
36        mtg_info info;
37        char **aliasv;
38        int naliases;
39       
40#if defined(__APPLE__) && defined(__MACH__)
41        add_error_table(&et_dsc_error_table);
42#else
43        initialize_dsc_error_table();
44#endif
45
46        dsc_expand_mtg_set(NULL, "*", &set, &n_matches, &code);
47
48        if (code)
49                punt_code("Can't expand meeting set", code);
50
51        if (!n_matches)
52                punt("No meetings?");
53
54        for (nbp = set; nbp < set + n_matches; ++nbp) {
55                dsc_get_mtg_info(nbp, &info, &code);
56                if (code) {
57                        printf("%s: %s\n", nbp->aliases[0],
58                               error_message(code));
59                        continue;
60                }
61                if (strcmp(nbp->aliases[0], info.long_name)) {
62                        printf("Adding long_name %s to %s\n",
63                               info.long_name, nbp->aliases[0]);
64
65                        /*
66                         * Beware of dragons and fenceposts in the
67                         * following code.
68                         */
69                        aliasv = nbp->aliases;
70                        while (*aliasv++) continue;
71                        naliases = aliasv - nbp->aliases;
72                        nbp->aliases = (char **) realloc(nbp->aliases,
73                                ++naliases * sizeof(nbp->aliases));
74                        aliasv = nbp->aliases + naliases;
75                        while(naliases--) {
76                                *aliasv = aliasv[-1];
77                                --aliasv;
78                        }
79                        if (aliasv != nbp->aliases) abort();
80                        *aliasv = info.long_name;
81                } else printf("Long name %s already present\n",
82                              info.long_name);
83        }
84        dsc_update_mtg_set(NULL, set, n_matches, &code);
85        if (code)
86                punt_code("update_mtg_set failed", code);
87}
88
89punt(string)
90        char *string;
91{
92        puts(string);
93        exit(1);
94}
95
96punt_code(string, code)
97        char *string;
98        int code;
99{
100        printf("%s: %s", string, error_message(code));
101        exit(1);
102}
103
104       
Note: See TracBrowser for help on using the repository browser.