1 /*
2 * vms.h - miscellaneous definitions for use with VMS system services.
3 * Pat Rankin, Nov'89
4 */
5
6 #if 1
7 #include <iodef.h>
8 #else
9 #define IO$_WRITEVBLK 48 /* write virtual block */
10 #define IO$V_CANCTRLO 6 /* cancel <ctrl/O> (ie, resume tty output) */
11 #define IO$M_CANCTRLO (1 << IO$V_CANCTRLO)
12 #endif
13
14 #if 1
15 #include <clidef.h>
16 #include <cliverbdef.h>
17 #include <fscndef.h>
18 #else
19 #define CLI$K_GETCMD 1
20 #define CLI$K_VERB_MCR 33
21 #define CLI$K_VERB_RUN 36
22 #define FSCN$_FILESPEC 1
23 #endif
24
25 #if 1
26 #include <climsgdef.h>
27 #else
28 #define CLI$_INSFPRM 0x00038048 /* insufficient parameters */
29 #define CLI$_VALREQ 0x00038150 /* missing required value */
30 #define CLI$_NEGATED 0x000381F8 /* explicitly negated */
31 #define CLI$_CONFLICT 0x00038258 /* conflicting qualifiers */
32 #define CLI$_NOOPTPRS 0x00038840 /* no option present */
33 #endif
34 /* Missing in VAX/VMS 7.3 */
35 #ifndef CLI$_RUNUSED
36 #define CLI$_RUNUSED 0x00030000 /* value returned by $CLI for "RUN" */
37 #endif
38 /* Missing as of VMS 8.4 */
39 #ifndef CLI$_SYNTAX
40 #define CLI$_SYNTAX 0x000310FC /* error signalled by CLI$DCL_PARSE */
41 #endif
42
43
44 #if 1
45 #include <psldef.h>
46 #else
47 #define PSL$C_USER 3 /* user mode */
48 #endif
49
50 /* note: `ulong' and `u_long' end up conflicting with various header files */
51 typedef unsigned long U_Long;
52 typedef unsigned short U_Short;
53
54 #include <descrip.h>
55 #include <stsdef.h>
56
57 #pragma member_alignment save
58 #pragma nomember_alignment longword
59 #pragma message save
60 #pragma message disable misalgndmem
61 typedef struct _itm { U_Short len, code; void *buffer; U_Short *retlen; } Itm;
62 #pragma message restore
63 #pragma member_alignment restore
64
65
66 #define vmswork(sts) $VMS_STATUS_SUCCESS(sts)
67 #define vmsfail(sts) (!$VMS_STATUS_SUCCESS(sts))
68 #define CondVal(sts) ((sts)&0x0FFFFFF8) /* strip severity & msg inhibit */
69 #define Descrip(strdsc,strbuf) struct dsc$descriptor_s \
70 strdsc = {sizeof strbuf - 1, DSC$K_DTYPE_T, DSC$K_CLASS_S, (char *)strbuf}
71
72 extern int shell$is_shell(void);
73 extern U_Long LIB$FIND_FILE(const struct dsc$descriptor_s *,
74 struct dsc$descriptor_s *, void *, ...);
75 extern U_Long LIB$FIND_FILE_END(void *);
76 #ifndef NO_TTY_FWRITE
77 extern U_Long LIB$GET_EF(long *);
78 extern U_Long SYS$ASSIGN(const struct dsc$descriptor_s *, short *, long,
79 const struct dsc$descriptor_s *);
80 extern U_Long SYS$DASSGN(short);
81 extern U_Long SYS$QIO(U_Long, U_Long, U_Long, void *,
82 void (*)(U_Long), U_Long,
83 const char *, int, int, U_Long, int, int);
84 extern U_Long SYS$SYNCH(long, void *);
85 #endif /*!NO_TTY_FWRITE*/
86 extern U_Long LIB$SPAWN(const struct dsc$descriptor_s *,
87 const struct dsc$descriptor_s *,
88 const struct dsc$descriptor_s *,
89 const U_Long *,
90 const struct dsc$descriptor_s *,
91 U_Long *, U_Long * ,...);
92 /* system services for logical name manipulation */
93 extern U_Long SYS$TRNLNM(const U_Long *,
94 const struct dsc$descriptor_s *,
95 const struct dsc$descriptor_s *,
96 const unsigned char *, Itm *);
97 extern U_Long SYS$CRELNM(const U_Long *,
98 const struct dsc$descriptor_s *,
99 const struct dsc$descriptor_s *,
100 const unsigned char *, const Itm *);
101 extern U_Long SYS$CRELOG(int,
102 const struct dsc$descriptor_s *,
103 const struct dsc$descriptor_s *,
104 unsigned char);
105 extern U_Long SYS$DELLNM(const struct dsc$descriptor_s *,
106 const struct dsc$descriptor_s *,
107 const unsigned char *);
108
109 extern void v_add_arg(int, const char *);
110 extern void vms_exit(int);
111 extern char *vms_strerror(int);
112 extern char *vms_strdup(const char *);
113 extern int vms_devopen(const char *,int);
114 extern int vms_execute(const char *, const char *, const char *);
115 extern int vms_gawk(void);
116 extern U_Long Cli_Present(const char *);
117 extern U_Long Cli_Get_Value(const char *, char *, int);
118 extern U_Long Cli_Parse_Command(const void *, const char *);
119