home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / include / expect.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-22  |  2.7 KB  |  77 lines

  1. /* expect.h - include file for using the expect library, libexpect.a
  2. from C or C++ (i.e., without Tcl)
  3.  
  4. Written by: Don Libes, libes@cme.nist.gov, NIST, 12/3/90
  5.  
  6. Design and implementation of this program was paid for by U.S. tax
  7. dollars.  Therefore it is public domain.  However, the author and NIST
  8. would appreciate credit if this program or parts of it are used.
  9. */
  10.  
  11. #ifndef _EXPECT_H
  12. #define _EXPECT_H
  13.  
  14. #include "expect_comm.h"
  15.  
  16. enum exp_type {
  17.     exp_end = 0,        /* placeholder - no more cases */
  18.     exp_glob,        /* glob-style */
  19.     exp_exact,        /* exact string */
  20.     exp_regexp,        /* regexp-style, uncompiled */
  21.     exp_compiled,        /* regexp-style, compiled */
  22.     exp_null,        /* matches binary 0 */
  23.     exp_bogus        /* aid in reporting compatibility problems */
  24. };
  25.  
  26. struct exp_case {        /* case for expect command */
  27.     char *pattern;
  28.     regexp *re;
  29.     enum exp_type type;
  30.     int value;        /* value to be returned upon match */
  31. };
  32.  
  33. EXTERN char *exp_buffer;        /* buffer of matchable chars */
  34. EXTERN char *exp_buffer_end;        /* one beyond end of matchable chars */
  35. EXTERN char *exp_match;            /* start of matched string */
  36. EXTERN char *exp_match_end;        /* one beyond end of matched string */
  37. EXTERN int exp_match_max;        /* bytes */
  38. EXTERN int exp_timeout;            /* seconds */
  39. EXTERN int exp_full_buffer;        /* if true, return on full buffer */
  40. EXTERN int exp_remove_nulls;        /* if true, remove nulls */
  41.  
  42. EXTERN int exp_pty_timeout;        /* see Cray hooks in source */
  43. EXTERN int exp_pid;            /* process-id of spawned process */
  44. EXTERN int exp_autoallocpty;        /* if TRUE, we do allocation */
  45. EXTERN int exp_pty[2];            /* master is [0], slave is [1] */
  46. EXTERN char *exp_pty_slave_name;    /* name of pty slave device if we */
  47.                     /* do allocation */
  48. EXTERN char *exp_stty_init;        /* initial stty args */
  49. EXTERN int exp_ttycopy;            /* copy tty parms from /dev/tty */
  50. EXTERN int exp_ttyinit;            /* set tty parms to sane state */
  51. EXTERN int exp_console;            /* redirect console */
  52.  
  53. EXTERN jmp_buf exp_readenv;        /* for interruptable read() */
  54. EXTERN int exp_reading;            /* whether we can longjmp or not */
  55. #define EXP_ABORT    1        /* abort read */
  56. #define EXP_RESTART    2        /* restart read */
  57.  
  58. EXTERN int exp_logfile_all;
  59. EXTERN FILE *exp_debugfile;
  60. EXTERN FILE *exp_logfile;
  61.  
  62. EXTERN int exp_disconnect EXP_PROTO(());
  63. EXTERN FILE *exp_popen    EXP_PROTO((char *command));
  64. EXTERN void (*exp_child_exec_prelude) EXP_PROTO((void));
  65.  
  66. #ifndef EXP_DEFINE_FNS
  67. EXTERN int exp_spawnl    EXP_PROTOV((char *file EXP_VARARGS));
  68. EXTERN int exp_expectl    EXP_PROTOV((int fd EXP_VARARGS));
  69. EXTERN int exp_fexpectl    EXP_PROTOV((FILE *fp EXP_VARARGS));
  70. #endif
  71.  
  72. EXTERN int exp_spawnv    EXP_PROTO((char *file, char *argv[]));
  73. EXTERN int exp_expectv    EXP_PROTO((int fd, struct exp_case *cases));
  74. EXTERN int exp_fexpectv    EXP_PROTO((FILE *fp, struct exp_case *cases));
  75.  
  76. #endif /* _EXPECT_H */
  77.