Mercurial > hg > xemacs-beta
comparison lib-src/etags.c @ 438:84b14dcb0985 r21-2-27
Import from CVS: tag r21-2-27
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:32:25 +0200 |
parents | 3a7e78e1142d |
children | abe6d1db359e |
comparison
equal
deleted
inserted
replaced
437:e2a4e8b94b82 | 438:84b14dcb0985 |
---|---|
94 #endif /* HAVE_UNISTD_H */ | 94 #endif /* HAVE_UNISTD_H */ |
95 | 95 |
96 #include <stdio.h> | 96 #include <stdio.h> |
97 #include <ctype.h> | 97 #include <ctype.h> |
98 #include <errno.h> | 98 #include <errno.h> |
99 #ifndef errno | |
100 extern int errno; | |
101 #endif | |
102 #include <sys/types.h> | 99 #include <sys/types.h> |
103 #include <sys/stat.h> | 100 #include <sys/stat.h> |
104 | 101 |
105 #if !defined (S_ISREG) && defined (S_IFREG) | 102 #if !defined (S_ISREG) && defined (S_IFREG) |
106 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) | 103 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) |
191 char *name; | 188 char *name; |
192 Lang_function *function; | 189 Lang_function *function; |
193 char **suffixes; | 190 char **suffixes; |
194 char **interpreters; | 191 char **interpreters; |
195 } language; | 192 } language; |
196 | |
197 extern char *getenv (); | |
198 | 193 |
199 typedef struct node_st | 194 typedef struct node_st |
200 { /* sorting structure */ | 195 { /* sorting structure */ |
201 char *name; /* function or type name */ | 196 char *name; /* function or type name */ |
202 char *file; /* file name */ | 197 char *file; /* file name */ |
280 char *concat (char *s1, char *s2, char *s3); | 275 char *concat (char *s1, char *s2, char *s3); |
281 char *skip_spaces (char *cp); | 276 char *skip_spaces (char *cp); |
282 char *skip_non_spaces (char *cp); | 277 char *skip_non_spaces (char *cp); |
283 char *savenstr (char *cp, int len); | 278 char *savenstr (char *cp, int len); |
284 char *savestr (char *cp); | 279 char *savestr (char *cp); |
285 char *etags_strchr (char *sp, char c); | 280 char *etags_strchr (const char *sp, int c); |
286 char *etags_strrchr (char *sp, char c); | 281 char *etags_strrchr (const char *sp, int c); |
287 char *etags_getcwd (void); | 282 char *etags_getcwd (void); |
288 char *relative_filename (char *file, char *dir); | 283 char *relative_filename (char *file, char *dir); |
289 char *absolute_filename (char *file, char *dir); | 284 char *absolute_filename (char *file, char *dir); |
290 char *absolute_dirname (char *file, char *dir); | 285 char *absolute_dirname (char *file, char *dir); |
291 bool filename_is_absolute (char *fn); | 286 bool filename_is_absolute (char *fn); |
1206 *extptr = suffix; | 1201 *extptr = suffix; |
1207 suffix += 1; | 1202 suffix += 1; |
1208 /* Let those poor souls who live with DOS 8+3 file name limits get | 1203 /* Let those poor souls who live with DOS 8+3 file name limits get |
1209 some solace by treating foo.cgz as if it were foo.c.gz, etc. | 1204 some solace by treating foo.cgz as if it were foo.c.gz, etc. |
1210 Only the first do loop is run if not MSDOS */ | 1205 Only the first do loop is run if not MSDOS */ |
1206 #ifdef MSDOS | |
1211 do | 1207 do |
1212 { | 1208 { |
1213 for (compr = compressors; compr->suffix != NULL; compr++) | 1209 for (compr = compressors; compr->suffix != NULL; compr++) |
1214 if (streq (compr->suffix, suffix)) | 1210 if (streq (compr->suffix, suffix)) |
1215 return compr; | 1211 return compr; |
1216 #ifndef MSDOS | |
1217 break; | |
1218 #endif | |
1219 if (extptr != NULL) | 1212 if (extptr != NULL) |
1220 *extptr = ++suffix; | 1213 *extptr = ++suffix; |
1221 } while (*suffix != '\0'); | 1214 } while (*suffix != '\0'); |
1215 #else | |
1216 for (compr = compressors; compr->suffix != NULL; compr++) | |
1217 if (streq (compr->suffix, suffix)) | |
1218 return compr; | |
1219 #endif | |
1220 | |
1222 return NULL; | 1221 return NULL; |
1223 } | 1222 } |
1224 | 1223 |
1225 | 1224 |
1226 | 1225 |
5110 } | 5109 } |
5111 | 5110 |
5112 /* | 5111 /* |
5113 * Return the ptr in sp at which the character c last | 5112 * Return the ptr in sp at which the character c last |
5114 * appears; NULL if not found | 5113 * appears; NULL if not found |
5115 * | |
5116 * Identical to System V strrchr, included for portability. | |
5117 */ | 5114 */ |
5118 char * | 5115 char * |
5119 etags_strrchr (sp, c) | 5116 etags_strrchr (sp, c) |
5120 register char *sp, c; | 5117 const char *sp; |
5121 { | 5118 int c; |
5122 register char *r; | 5119 { |
5120 register const char *r; | |
5123 | 5121 |
5124 r = NULL; | 5122 r = NULL; |
5125 do | 5123 do |
5126 { | 5124 { |
5127 if (*sp == c) | 5125 if (*sp == c) |
5128 r = sp; | 5126 r = sp; |
5129 } while (*sp++); | 5127 } while (*sp++); |
5130 return r; | 5128 return (char *) r; |
5131 } | 5129 } |
5132 | 5130 |
5133 | 5131 |
5134 /* | 5132 /* |
5135 * Return the ptr in sp at which the character c first | 5133 * Return the ptr in sp at which the character c first |
5136 * appears; NULL if not found | 5134 * appears; NULL if not found |
5137 * | |
5138 * Identical to System V strchr, included for portability. | |
5139 */ | 5135 */ |
5140 char * | 5136 char * |
5141 etags_strchr (sp, c) | 5137 etags_strchr (sp, c) |
5142 register char *sp, c; | 5138 const char *sp; |
5139 int c; | |
5143 { | 5140 { |
5144 do | 5141 do |
5145 { | 5142 { |
5146 if (*sp == c) | 5143 if (*sp == c) |
5147 return sp; | 5144 return (char *) sp; |
5148 } while (*sp++); | 5145 } while (*sp++); |
5149 return NULL; | 5146 return NULL; |
5150 } | 5147 } |
5151 | 5148 |
5152 /* Skip spaces, return new pointer. */ | 5149 /* Skip spaces, return new pointer. */ |