comparison src/mule-mcpath.c @ 440:8de8e3f6228a r21-2-28

Import from CVS: tag r21-2-28
author cvs
date Mon, 13 Aug 2007 11:33:38 +0200
parents 697ef44129c6
children
comparison
equal deleted inserted replaced
439:357dd071b03c 440:8de8e3f6228a
30 #include "mule.h" 30 #include "mule.h"
31 31
32 Lisp_Object Qpathname_coding_system = 0; 32 Lisp_Object Qpathname_coding_system = 0;
33 33
34 static void 34 static void
35 mcpath_encode_code (struct Lisp_Coding_System *cp) 35 mcpath_encode_code (Lisp_Coding_System *cp)
36 { 36 {
37 Lisp_Object coding_system; 37 Lisp_Object coding_system;
38 38
39 coding_system = Fsymbol_value (Qpathname_coding_system); 39 coding_system = Fsymbol_value (Qpathname_coding_system);
40 40
44 44
45 static int 45 static int
46 mule_encode_path_1 (unsigned char *src, unsigned int srcsize, 46 mule_encode_path_1 (unsigned char *src, unsigned int srcsize,
47 unsigned char *dst, unsigned int dstsize) 47 unsigned char *dst, unsigned int dstsize)
48 { 48 {
49 struct Lisp_Coding_System code; 49 Lisp_Coding_System code;
50 50
51 mcpath_encode_code (&code); 51 mcpath_encode_code (&code);
52 if (CODE_TYPE (&code) > MULE_AUTOCONV) 52 if (CODE_TYPE (&code) > MULE_AUTOCONV)
53 { 53 {
54 unsigned char *buf; 54 unsigned char *buf;
74 74
75 static unsigned char * 75 static unsigned char *
76 mule_decode_path_1 (unsigned char *src, unsigned char *dst, 76 mule_decode_path_1 (unsigned char *src, unsigned char *dst,
77 unsigned int dstsize) 77 unsigned int dstsize)
78 { 78 {
79 struct Lisp_Coding_System code; 79 Lisp_Coding_System code;
80 80
81 mcpath_encode_code (&code); 81 mcpath_encode_code (&code);
82 if (CODE_TYPE (&code) > MULE_AUTOCONV) 82 if (CODE_TYPE (&code) > MULE_AUTOCONV)
83 { 83 {
84 int len; 84 int len;
237 #else /* HAVE_GETWD */ 237 #else /* HAVE_GETWD */
238 unsigned char * 238 unsigned char *
239 mc_getwd (unsigned char path[]) 239 mc_getwd (unsigned char path[])
240 { 240 {
241 unsigned char *p; 241 unsigned char *p;
242 242
243 p = getwd (path); 243 p = getwd (path);
244 if (p) 244 if (p)
245 { 245 {
246 unsigned char buffer[MC_MAXPATHLEN]; 246 unsigned char buffer[MC_MAXPATHLEN];
247 int len; 247 int len;
248 248
249 len = mule_encode_path_1 (path, strlen (path) + 1, buffer, sizeof buffer); 249 len = mule_encode_path_1 (path, strlen (path) + 1, buffer, sizeof buffer);
250 if (len > 0) 250 if (len > 0)
251 { 251 {
252 memcpy (path, buffer, len); 252 memcpy (path, buffer, len);
253 } 253 }