]>
diplodocus.org Git - nmh/blob - docs/historical/mh-nov-1983/cmds/install-mh.c
6 char *anoyes
[]; /* Std no/yes gans array */
13 register char *cp
, *path
;
14 register struct node
*np
;
20 setbuf(stdout
, _sobuf
);
21 autof
= (argc
== 2 && strcmp(argv
[1], "-auto") == 0);
22 exitstat
= 1; /* Assume errors will occur */
23 mypath
= getenv("HOME");
24 /*** mypath = getpath(getruid()); /* to prevent recursion via m_getdefs */
25 copy(mh_prof
, 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(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 %s which contains information\n",mypath
,mh_prof
+1);
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
.st_mode
&S_IFMT
) == S_IFDIR
) {
45 cp
= concat("You already have the standard MH directory \"",
46 cp
, "\".\nDo you want to use it for MH? ", 0);
53 cp
= concat("Do you want the standard MH path \"", mypath
,
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("/", geta(), 0);
69 if(chdir(path
) == -1) {
70 cp
= concat("\"", path
, "\" doesn't exist; Create it? ", 0);
72 if(makedir(path
) == 0) {
73 printf("Can't create it!\n");
77 printf("[Using existing directory]\n");
79 np
= m_defs
= (struct node
*) malloc(sizeof *np
);
83 m_replace(pfolder
, defalt
);
94 static char line
[128];
100 while((c
= getchar()) != EOF
) {