Mercurial > hg > xemacs-beta
annotate lib-src/make-path.c @ 5565:48a3d3281b48
Pass eighth bit on TTY consoles to coding system if needed.
src/ChangeLog addition:
2011-09-06 Aidan Kehoe <kehoea@parhasard.net>
* redisplay-tty.c (init_tty_for_redisplay):
Only set the console meta key flag to treat the eight bit as meta
if the native coding system doesn't need that.
* general-slots.h:
* mule-coding.c:
* mule-coding.c (syms_of_mule_coding):
Move Qiso2022, Qseven to general-slots.h, they're now used in
redisplay-tty.c.
lisp/ChangeLog addition:
2011-09-06 Aidan Kehoe <kehoea@parhasard.net>
* mule/mule-cmds.el (set-language-environment-coding-systems):
Set the input mode for TTY consoles to use the eighth bit for
character information if the native coding system for the language
environment needs that.
| author | Aidan Kehoe <kehoea@parhasard.net> |
|---|---|
| date | Tue, 06 Sep 2011 11:44:50 +0100 |
| parents | b9167d522a9a |
| children |
| rev | line source |
|---|---|
| 428 | 1 /* Make all the directories along a path. |
| 2 Copyright (C) 1992 Free Software Foundation, Inc. | |
| 3 | |
| 613 | 4 This file is part of XEmacs. |
| 428 | 5 |
|
5406
061f4f90f874
Convert lib-src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
5091
diff
changeset
|
6 XEmacs is free software: you can redistribute it and/or modify it |
|
061f4f90f874
Convert lib-src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
5091
diff
changeset
|
7 under the terms of the GNU General Public License as published by the |
|
061f4f90f874
Convert lib-src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
5091
diff
changeset
|
8 Free Software Foundation, either version 3 of the License, or (at your |
|
061f4f90f874
Convert lib-src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
5091
diff
changeset
|
9 option) any later version. |
| 428 | 10 |
|
5406
061f4f90f874
Convert lib-src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
5091
diff
changeset
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT |
|
061f4f90f874
Convert lib-src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
5091
diff
changeset
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
061f4f90f874
Convert lib-src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
5091
diff
changeset
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
061f4f90f874
Convert lib-src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
5091
diff
changeset
|
14 for more details. |
| 428 | 15 |
| 16 You should have received a copy of the GNU General Public License | |
|
5406
061f4f90f874
Convert lib-src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents:
5091
diff
changeset
|
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 428 | 18 |
| 19 /* Synched up with: FSF 19.28. */ | |
| 20 | |
| 21 /* This program works like mkdir, except that it generates | |
| 22 intermediate directories if they don't exist. This is just like | |
| 23 the `mkdir -p' command on most systems; unfortunately, the mkdir | |
| 24 command on some of the purer BSD systems (like Mt. Xinu) don't have | |
| 25 that option. */ | |
| 26 | |
| 5091 | 27 #ifdef HAVE_CONFIG_H |
| 438 | 28 #include <config.h> |
| 428 | 29 #endif |
| 30 | |
| 31 #include <sys/types.h> | |
| 32 #include <sys/stat.h> | |
| 33 #include <stdio.h> | |
| 34 #include <errno.h> | |
| 35 | |
| 36 char *prog_name; | |
| 37 | |
| 38 static int touchy_mkdir (char *path) | |
| 39 { | |
| 40 struct stat buf; | |
| 41 | |
| 42 /* If PATH already exists and is a directory, return success. */ | |
| 43 if (stat (path, &buf) >= 0 | |
| 44 && (buf.st_mode & S_IFMT) == S_IFDIR) | |
| 45 return 0; | |
| 46 | |
| 47 /* Otherwise, try to make it. If PATH exists but isn't a directory, | |
| 48 this will signal an error. */ | |
| 49 if (mkdir (path, 0777) < 0) | |
| 50 { | |
| 51 fprintf (stderr, "%s: ", prog_name); | |
| 52 perror (path); | |
| 53 return 1; | |
| 54 } | |
| 55 | |
| 56 return 0; | |
| 57 } | |
| 58 | |
| 59 int | |
| 60 main (int argc, char *argv[]) | |
| 61 { | |
| 62 prog_name = *argv; | |
| 63 | |
| 64 for (argc--, argv++; argc > 0; argc--, argv++) | |
| 65 { | |
| 66 char *path = *argv; | |
| 67 int i; | |
| 68 | |
| 69 /* Stop at each slash in path and try to create the directory. | |
| 70 Skip any initial slash. */ | |
| 71 for (i = (path[0] == '/') ? 1 : 0; path[i]; i++) | |
| 72 if (path[i] == '/') | |
| 73 { | |
| 74 path[i] = '\0'; | |
| 75 if (touchy_mkdir (path) < 0) | |
| 76 goto next_pathname; | |
| 77 path[i] = '/'; | |
| 78 } | |
| 79 | |
| 80 touchy_mkdir (path); | |
| 81 | |
| 82 next_pathname: | |
| 83 ; | |
| 84 } | |
| 85 | |
| 86 return 0; | |
| 87 } |
