Mercurial > hg > xemacs-beta
comparison src/termcap.c @ 209:41ff10fd062f r20-4b3
Import from CVS: tag r20-4b3
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:04:58 +0200 |
parents | 376386a54a3c |
children | 74fd4e045ea6 |
comparison
equal
deleted
inserted
replaced
208:f427b8ec4379 | 209:41ff10fd062f |
---|---|
251 /* Actual baud rate if positive; | 251 /* Actual baud rate if positive; |
252 - baud rate / 100 if negative. */ | 252 - baud rate / 100 if negative. */ |
253 | 253 |
254 static short speeds[] = | 254 static short speeds[] = |
255 { | 255 { |
256 #ifdef VMS | |
257 0, 50, 75, 110, 134, 150, -3, -6, -12, -18, | |
258 -20, -24, -36, -48, -72, -96, -192 | |
259 #else /* not VMS */ | |
260 0, 50, 75, 110, 135, 150, -2, -3, -6, -12, | 256 0, 50, 75, 110, 135, 150, -2, -3, -6, -12, |
261 -18, -24, -48, -96, -192, -288, -384, -576, -1152 | 257 -18, -24, -48, -96, -192, -288, -384, -576, -1152 |
262 #endif /* not VMS */ | |
263 }; | 258 }; |
264 | 259 |
265 void | 260 void |
266 tputs (string, nlines, outfun) | 261 tputs (string, nlines, outfun) |
267 CONST char *string; | 262 CONST char *string; |
333 static int scan_file (); | 328 static int scan_file (); |
334 static char *gobble_line (); | 329 static char *gobble_line (); |
335 static int compare_contin (); | 330 static int compare_contin (); |
336 static int name_match (); | 331 static int name_match (); |
337 | 332 |
338 #ifdef VMS | |
339 | |
340 #include <rmsdef.h> | |
341 #include <fab.h> | |
342 #include <nam.h> | |
343 | |
344 static int | |
345 legal_filename_p (fn) | |
346 char *fn; | |
347 { | |
348 struct FAB fab = cc$rms_fab; | |
349 struct NAM nam = cc$rms_nam; | |
350 char esa[NAM$C_MAXRSS]; | |
351 | |
352 fab.fab$l_fna = fn; | |
353 fab.fab$b_fns = strlen(fn); | |
354 fab.fab$l_nam = &nam; | |
355 fab.fab$l_fop = FAB$M_NAM; | |
356 | |
357 nam.nam$l_esa = esa; | |
358 nam.nam$b_ess = sizeof esa; | |
359 | |
360 return SYS$PARSE(&fab, 0, 0) == RMS$_NORMAL; | |
361 } | |
362 | |
363 #endif /* VMS */ | |
364 | 333 |
365 /* Find the termcap entry data for terminal type NAME | 334 /* Find the termcap entry data for terminal type NAME |
366 and store it in the block that BP points to. | 335 and store it in the block that BP points to. |
367 Record its address for future use. | 336 Record its address for future use. |
368 | 337 |
383 CONST char *term; | 352 CONST char *term; |
384 int malloc_size = 0; | 353 int malloc_size = 0; |
385 int c; | 354 int c; |
386 char *tcenv; /* TERMCAP value, if it contais :tc=. */ | 355 char *tcenv; /* TERMCAP value, if it contais :tc=. */ |
387 CONST char *indirect = 0; /* Terminal type in :tc= in TERMCAP value. */ | 356 CONST char *indirect = 0; /* Terminal type in :tc= in TERMCAP value. */ |
388 int filep; | |
389 | 357 |
390 tem = getenv ("TERMCAP"); | 358 tem = getenv ("TERMCAP"); |
391 if (tem && *tem == 0) tem = 0; | 359 if (tem && *tem == 0) tem = 0; |
392 | 360 |
393 #ifdef VMS | |
394 filep = tem && legal_filename_p (tem); | |
395 #else | |
396 filep = tem && (*tem == '/'); | |
397 #endif /* VMS */ | |
398 | 361 |
399 /* If tem is non-null and starts with / (in the un*x case, that is), | 362 /* If tem is non-null and starts with / (in the un*x case, that is), |
400 it is a file name to use instead of /etc/termcap. | 363 it is a file name to use instead of /etc/termcap. |
401 If it is non-null and does not start with /, | 364 If it is non-null and does not start with /, |
402 it is the entry itself, but only if | 365 it is the entry itself, but only if |
403 the name the caller requested matches the TERM variable. */ | 366 the name the caller requested matches the TERM variable. */ |
404 | 367 |
405 if (tem && !filep && !strcmp (name, (char *) getenv ("TERM"))) | 368 if (tem && !IS_DIRECTORY_SEP (*tem) && !strcmp (name, (char *) getenv ("TERM"))) |
406 { | 369 { |
407 indirect = tgetst1 (find_capability (tem, "tc"), 0); | 370 indirect = tgetst1 (find_capability (tem, "tc"), 0); |
408 if (!indirect) | 371 if (!indirect) |
409 { | 372 { |
410 if (!bp) | 373 if (!bp) |
421 } | 384 } |
422 else | 385 else |
423 indirect = (char *) 0; | 386 indirect = (char *) 0; |
424 | 387 |
425 if (!tem) | 388 if (!tem) |
426 #ifdef VMS | |
427 tem = "emacs_library:[etc]termcap.dat"; | |
428 #else | |
429 tem = "/etc/termcap"; | 389 tem = "/etc/termcap"; |
430 #endif | |
431 | 390 |
432 /* Here we know we must search a file and tem has its name. */ | 391 /* Here we know we must search a file and tem has its name. */ |
433 | 392 |
434 fd = open (tem, 0, 0); | 393 fd = open (tem, 0, 0); |
435 if (fd < 0) | 394 if (fd < 0) |