annotate netinstall/mkdir.cc @ 4944:6af9b2e79451

Fixes to configure so --with-error-checking=yes works -------------------- ChangeLog entries follow: -------------------- ChangeLog addition: 2010-01-23 Ben Wing <ben@xemacs.org> * configure: * configure.ac (XE_COMPLEX_ARG): Expand the help for --with-debug to describe more specifically what exactly gets turned on. Expand the help for --with-error-checking to describe all the possible arguments, including `all', `none', `noFOO', multiple arguments, etc. Change so that `--with-error-checking' is the same as `--with-error-checking=all'. Currently, `--with-error-checking' has no effect at all! It just means "leave all error-checking for specific classes to their default values", which are "maybe", and get converted to "yes" or "no" depending on whether we are running a beta XEmacs.
author Ben Wing <ben@xemacs.org>
date Sat, 23 Jan 2010 04:45:49 -0600
parents 3078fd1074e8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
1 /*
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
2 * Copyright (c) 2000, Red Hat, Inc.
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
3 *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
7 * (at your option) any later version.
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
8 *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
9 * A copy of the GNU General Public License can be found at
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
10 * http://www.gnu.org/
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
11 *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
12 * Written by DJ Delorie <dj@cygnus.com>
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
13 *
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
14 */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
15
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
16 /* see mkdir.h */
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
17
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
18 #include "win32.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
19 #include <stdio.h>
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
20 #include "mkdir.h"
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
21
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
22 int
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
23 mkdir_p (int isadir, char *path)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
24 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
25 char saved_char, *slash = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
26 char *c;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
27 DWORD d, gse;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
28
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
29 d = GetFileAttributes (path);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
30 if (d != 0xffffffff && d & FILE_ATTRIBUTE_DIRECTORY)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
31 return 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
32
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
33 if (isadir)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
34 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
35 if (CreateDirectory (path, 0))
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
36 return 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
37 gse = GetLastError ();
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
38 if (gse != ERROR_PATH_NOT_FOUND && gse != ERROR_FILE_NOT_FOUND)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
39 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
40 if (gse == ERROR_ALREADY_EXISTS)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
41 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
42 fprintf (stderr, "warning: deleting \"%s\" so I can make a directory there\n",
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
43 path);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
44 if (DeleteFileA (path))
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
45 return mkdir_p (isadir, path);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
46 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
47 return 1;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
48 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
49 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
50
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
51 for (c=path; *c; c++)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
52 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
53 if (*c == ':')
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
54 slash = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
55 if (*c == '/' || *c == '\\')
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
56 slash = c;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
57 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
58
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
59 if (!slash)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
60 return 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
61
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
62 saved_char = *slash;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
63 *slash = 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
64 if (mkdir_p (1, path))
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
65 {
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
66 *slash = saved_char;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
67 return 1;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
68 }
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
69 *slash = saved_char;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
70
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
71 if (!isadir)
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
72 return 0;
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
73
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
74 return mkdir_p (isadir, path);
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents:
diff changeset
75 }