source: trunk/athena/bin/discuss/mclient/dsc_setup.c @ 12350

Revision 12350, 821 bytes checked in by ghudson, 25 years ago (diff)
Some RCS ID cleanup: delete $Log$ and replace other RCS keywords with $Id$.
Line 
1#include <stdio.h>
2#include <sys/param.h>
3#include <sys/file.h>
4#include <pwd.h>
5
6struct passwd *pwd;
7char pathname[MAXPATHLEN];
8int fd;
9
10char *text = "0:0:0:charon.mit.edu:/var/spool/discuss/new_meetings:New_Meetings,new_meetings:\n0:541394699:24:charon.mit.edu:/var/spool/discuss/eve:Everybody,eve:\n";
11
12#ifndef lint
13static char rcsid_dsc_setup_c[] = "$Id: dsc_setup.c,v 1.3 1999-01-22 23:10:08 ghudson Exp $";
14#endif
15
16main()
17{
18        int len = strlen(text);
19        pwd = getpwuid(getuid());
20        if (!pwd) {
21                fprintf(stderr, "Who are you?\n");
22                exit(1);
23        }
24        strcpy(pathname, pwd->pw_dir);
25        strcat(pathname, "/.meetings");
26        fd = open(pathname, O_RDWR|O_CREAT|O_EXCL, 0666);
27        if (fd < 0) {
28                perror(pathname);
29                exit(1);
30        }
31        if (write(fd, text, len) != len) {
32                perror("write failed");
33                unlink(pathname);
34                exit(1);
35        }
36        close(fd);
37}
Note: See TracBrowser for help on using the repository browser.