]>
diplodocus.org Git - nmh/blob - docs/historical/SRI-NOSC/install-defs.c
5 char *anoyes
[], /* Std no/yes gans array */
10 char *mypath
, defpath
[128];
15 register char *cp
, *path
;
16 register struct node
*np
;
17 int autof
, detached
, exitstat
;
21 autof
= (argc
== 2 && equal(argv
[1], "-auto"));
22 detached
= (argc
== 2 && equal(argv
[1], "-detached"));
23 exitstat
= 1; /* Assume errors will occur */
24 mypath
= getpath(getruid()); /* to prevent recursion via m_getdefs */
25 copy(mh_defs
, copy(mypath
, defpath
));
26 if(stat(defpath
, &stbuf
) != -1) {
28 printf("Install-defs invocation error!\n");
30 printf("You already have an MH profile... use an editor \
35 if(!detached
&& (autof
|| gans("Do you want help? ", anoyes
))) {
36 printf("\nPrior to using MH, it is necessary to have a file in your login\n");
37 printf("directory (%s) named .mh_defs which contains information\n",mypath
);
38 printf("to direct certain MH operations. The only item which is required\n");
39 printf("is the path to use for all MH folder operations. The suggested MH\n");
40 printf("path for you is %s/mail...\n\n", mypath
);
42 cp
= concat(mypath
, "/", "mail", 0);
43 if(stat(cp
, &stbuf
) != -1) {
44 if((stbuf
.i_mode
&IFMT
) == IFDIR
) {
45 cp
= concat("You already have the standard MH directory \"",
46 cp
, "\".\nDo you want to use it for MH? ", 0);
47 if( detached
? TRUE
: gans(cp
, anoyes
))
53 cp
= concat("Do you want the standard MH path \"", mypath
,
55 if( detached
? TRUE
: gans(cp
, anoyes
))
58 xyz
: if(gans("Do you want a path below your login directory? ",
60 printf("What is the path ?? %s/", mypath
);
63 printf("What is the whole path?? /");
64 path
= concat("/", getans(), 0);
69 if(chdir(path
) == -1) {
70 cp
= concat("\"", path
, "\" doesn't exist; Create it? ", 0);
71 if( detached
? TRUE
: gans(cp
, anoyes
))
72 if(makedir(path
) == 0) {
73 if (!detached
) printf("Can't create it!\n");
77 if (!detached
) printf("[Using existing directory]\n");
79 np
= m_defs
= alloc(sizeof *np
);
83 m_replace("folder", defalt
);
95 static char line
[128];
101 while(c
= getchar()) {