/* Interfaces to system-dependent kernel and library entries.
- Copyright (C) 1985, 1986, 1987, 1988, 1992 Free Software Foundation, Inc.
+ Copyright (C) 1985, 1986, 1987, 1988, 1993 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include "config.h"
#include "lisp.h"
+#include "blockinput.h"
#undef NULL
#define min(x,y) ((x) > (y) ? (y) : (x))
#undef open
#endif /* `open' is a macro */
+/* Does anyone other than VMS need this? */
+#ifndef fwrite
+#define sys_fwrite fwrite
+#else
+#undef fwrite
+#endif
+
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#endif /* DGUX */
#include <sys/ioctl.h>
-#include "systerm.h"
+#include "systty.h"
#ifdef BSD
#ifdef BSD4_1
This allows us to write more code that works for both VMS and Unix. */
static int input_fd;
-#ifdef VMS
-static struct iosb
-{
- short status;
- short offset;
- short termlen;
- short term;
-} input_iosb;
-
-int kbd_input_ast ();
-
-int waiting_for_ast;
-int stop_input;
-int input_ef = 0;
-int timer_ef = 0;
-int process_ef = 0;
-int input_eflist;
-int timer_eflist;
-
-static $DESCRIPTOR (input_dsc, "TT");
-static int terminator_mask[2] = { 0, 0 };
-
-static struct sensemode {
- short status;
- unsigned char xmit_baud;
- unsigned char rcv_baud;
- unsigned char crfill;
- unsigned char lffill;
- unsigned char parity;
- unsigned char unused;
- char class;
- char type;
- short scr_wid;
- unsigned long tt_char : 24, scr_len : 8;
- unsigned long tt2_char;
-} sensemode_iosb;
-#endif /* VMS */
-
discard_tty_input ()
{
struct emacs_tty buf;
&sg.class, 12, 0, 0, 0, 0 );
ospeed = sg.xmit_baud;
#else /* not VMS */
-#ifdef HAVE_TERMIO
- struct termio sg;
+#ifdef HAVE_TERMIOS
+ struct termios sg;
sg.c_cflag = (sg.c_cflag & ~CBAUD) | B9600;
tcgetattr (0, &sg);
ospeed = sg.c_cflag & CBAUD;
-#else /* neither VMS nor TERMIO */
-#ifdef HAVE_TERMIOS
- struct termios sg;
+#else /* neither VMS nor TERMIOS */
+#ifdef HAVE_TERMIO
+ struct termio sg;
sg.c_cflag = (sg.c_cflag & ~CBAUD) | B9600;
+#ifdef HAVE_TCATTR
tcgetattr (0, &sg);
+#else
+ ioctl (input_fd, TCGETA, &sg);
+#endif
ospeed = sg.c_cflag & CBAUD;
-#else /* neither VMS nor TERMIO nor TERMIOS */
+#else /* neither VMS nor TERMIOS nor TERMIO */
struct sgttyb sg;
sg.sg_ospeed = B9600;
ioctl (0, TIOCGETP, &sg);
ospeed = sg.sg_ospeed;
-#endif /* not HAVE_TERMIOS */
#endif /* not HAVE_TERMIO */
+#endif /* not HAVE_TERMIOS */
#endif /* not VMS */
}
#ifdef VMS
int status;
- status = sys$forcex (&pid, 0, 0);
+ status = SYS$FORCEX (&pid, 0, 0);
break;
#else /* not VMS */
-
- /* Exit if the process has terminated. */
- if (!synch_process_alive)
+#if (defined (BSD) && !defined (LINUX)) || (defined (HPUX) && !defined (HPUX_5))
+ /* Note that kill returns -1 even if the process is just a zombie now.
+ But inevitably a SIGCHLD interrupt should be generated
+ and child_sig will do wait3 and make the process go away. */
+ /* There is some indication that there is a bug involved with
+ termination of subprocesses, perhaps involving a kernel bug too,
+ but no idea what it is. Just as a hunch we signal SIGCHLD to see
+ if that causes the problem to go away or get worse. */
+ sigsetmask (sigmask (SIGCHLD));
+ if (0 > kill (pid, 0))
+ {
+ sigsetmask (SIGEMPTYMASK);
+ kill (getpid (), SIGCHLD);
+ break;
+ }
+ if (wait_debugging)
+ sleep (1);
+ else
+ sigpause (SIGEMPTYMASK);
+#else /* not BSD, not LINUX, and not HPUX version >= 6 */
+#if defined (UNIPLUS) || defined (LINUX)
+ if (0 > kill (pid, 0))
break;
- /* Otherwise wait 1 second or until a signal comes in. */
- signal (SIGALRM, wait_for_termination_signal);
- alarm (1);
- pause ();
- alarm (0);
- signal (SIGALRM, SIG_IGN);
+ wait (0);
+#else /* neither BSD nor UNIPLUS nor LINUX: random sysV */
+#ifdef HAVE_SYSV_SIGPAUSE
+ sighold (SIGCHLD);
+ if (0 > kill (pid, 0))
+ {
+ sigrelse (SIGCHLD);
+ break;
+ }
+ sigpause (SIGCHLD);
+#else /* not HAVE_SYSV_SIGPAUSE */
+ if (0 > kill (pid, 0))
+ break;
+ /* Using sleep instead of pause avoids timing error.
+ If the inferior dies just before the sleep,
+ we lose just one second. */
+ sleep (1);
+#endif /* not HAVE_SYSV_SIGPAUSE */
+#endif /* not UNIPLUS */
+#endif /* not BSD, and not HPUX version >= 6 */
#endif /* not VMS */
#else /* not subprocesses */
#ifndef BSD4_1
EMACS_GET_TTY (out, &s);
-#ifdef HAVE_TERMIO
+#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
s.main.c_oflag |= OPOST; /* Enable output postprocessing */
s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */
s.main.c_oflag &= ~(NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY);
sys_suspend ()
{
#ifdef VMS
- unsigned long parent_id;
+ /* "Foster" parentage allows emacs to return to a subprocess that attached
+ to the current emacs as a cheaper than starting a whole new process. This
+ is set up by KEPTEDITOR.COM. */
+ unsigned long parent_id, foster_parent_id;
+ char *fpid_string;
+
+ fpid_string = getenv ("EMACS_PARENT_PID");
+ if (fpid_string != NULL)
+ {
+ sscanf (fpid_string, "%x", &foster_parent_id);
+ if (foster_parent_id != 0)
+ parent_id = foster_parent_id;
+ else
+ parent_id = getppid ();
+ }
+ else
+ parent_id = getppid ();
+
+ xfree (fpid_string); /* On VMS, this was malloc'd */
- parent_id = getppid ();
if (parent_id && parent_id != 0xffffffff)
{
SIGTYPE (*oldsig)() = (int) signal (SIGINT, SIG_IGN);
} d_prompt;
d_prompt.l = sizeof ("Emacs: "); /* Our special prompt */
d_prompt.a = "Emacs: "; /* Just a reminder */
- lib$spawn (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &d_prompt, 0);
+ LIB$SPAWN (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &d_prompt, 0);
return 1;
}
return -1;
#ifdef subprocesses
close_process_descs (); /* Close Emacs's pipes/ptys */
#endif
- nice (-nice (0)); /* Give the new shell the default piority */
+
+#ifdef PRIO_PROCESS
+ {
+ extern int emacs_priority;
+
+ if (emacs_priority)
+ nice (-emacs_priority);
+ }
+#endif
+
execlp (sh, sh, 0);
write (1, "Can't execute subshell", 22);
_exit (1);
}
save_signal_handlers (saved_handlers);
+ synch_process_alive = 1;
wait_for_termination (pid);
restore_signal_handlers (saved_handlers);
#endif /* FASYNC */
#endif /* F_SETFL */
\f
+/* Getting and setting emacs_tty structures. */
+
+/* Set *TC to the parameters associated with the terminal FD.
+ Return zero if all's well, or -1 if we ran into an error we
+ couldn't deal with. */
+int
+emacs_get_tty (fd, settings)
+ int fd;
+ struct emacs_tty *settings;
+{
+ /* Retrieve the primary parameters - baud rate, character size, etcetera. */
+#ifdef HAVE_TCATTR
+ /* We have those nifty POSIX tcmumbleattr functions. */
+ if (tcgetattr (fd, &settings->main) < 0)
+ return -1;
+
+#else
+#ifdef HAVE_TERMIO
+ /* The SYSV-style interface? */
+ if (ioctl (fd, TCGETA, &settings->main) < 0)
+ return -1;
+
+#else
+#ifdef VMS
+ /* Vehemently Monstrous System? :-) */
+ if (! (SYS$QIOW (0, fd, IO$_SENSEMODE, settings, 0, 0,
+ &settings->main.class, 12, 0, 0, 0, 0)
+ & 1))
+ return -1;
+
+#else
+ /* I give up - I hope you have the BSD ioctls. */
+ if (ioctl (fd, TIOCGETP, &settings->main) < 0)
+ return -1;
+
+#endif
+#endif
+#endif
+
+ /* Suivant - Do we have to get struct ltchars data? */
+#ifdef TIOCGLTC
+ if (ioctl (fd, TIOCGLTC, &settings->ltchars) < 0)
+ return -1;
+#endif
+
+ /* How about a struct tchars and a wordful of lmode bits? */
+#ifdef TIOCGETC
+ if (ioctl (fd, TIOCGETC, &settings->tchars) < 0
+ || ioctl (fd, TIOCLGET, &settings->lmode) < 0)
+ return -1;
+#endif
+
+ /* We have survived the tempest. */
+ return 0;
+}
+
+
+/* Set the parameters of the tty on FD according to the contents of
+ *SETTINGS. If WAITP is non-zero, we wait for all queued output to
+ be written before making the change; otherwise, we forget any
+ queued input and make the change immediately.
+ Return 0 if all went well, and -1 if anything failed. */
+int
+emacs_set_tty (fd, settings, waitp)
+ int fd;
+ struct emacs_tty *settings;
+ int waitp;
+{
+ /* Set the primary parameters - baud rate, character size, etcetera. */
+#ifdef HAVE_TCATTR
+ /* We have those nifty POSIX tcmumbleattr functions.
+ William J. Smith <wjs@wiis.wang.com> writes:
+ "POSIX 1003.1 defines tcsetattr() to return success if it was
+ able to perform any of the requested actions, even if some
+ of the requested actions could not be performed.
+ We must read settings back to ensure tty setup properly.
+ AIX requires this to keep tty from hanging occasionally." */
+ for (;;)
+ if (tcsetattr (fd, waitp ? TCSAFLUSH : TCSADRAIN, &settings->main) < 0)
+ {
+ if (errno == EINTR)
+ continue;
+ else
+ return -1;
+ }
+ else
+ {
+ struct termios new;
+
+ /* Get the current settings, and see if they're what we asked for. */
+ tcgetattr (fd, &new);
+ if (memcmp (&new, &settings->main, sizeof (new)))
+ continue;
+ else
+ break;
+ }
+
+#else
+#ifdef HAVE_TERMIO
+ /* The SYSV-style interface? */
+ if (ioctl (fd, waitp ? TCSETAW : TCSETAF, &settings->main) < 0)
+ return -1;
+
+#else
+#ifdef VMS
+ /* Vehemently Monstrous System? :-) */
+ if (! (SYS$QIOW (0, fd, IO$_SETMODE, &input_iosb, 0, 0,
+ &settings->main.class, 12, 0, 0, 0, 0)
+ & 1))
+ return -1;
+
+#else
+ /* I give up - I hope you have the BSD ioctls. */
+ if (ioctl (fd, (waitp) ? TIOCSETP : TIOCSETN, &settings->main) < 0)
+ return -1;
+
+#endif
+#endif
+#endif
+
+ /* Suivant - Do we have to get struct ltchars data? */
+#ifdef TIOCGLTC
+ if (ioctl (fd, TIOCSLTC, &settings->ltchars) < 0)
+ return -1;
+#endif
+
+ /* How about a struct tchars and a wordful of lmode bits? */
+#ifdef TIOCGETC
+ if (ioctl (fd, TIOCSETC, &settings->tchars) < 0
+ || ioctl (fd, TIOCLSET, &settings->lmode) < 0)
+ return -1;
+#endif
+
+ /* We have survived the tempest. */
+ return 0;
+}
+
+\f
/* The initial tty mode bits */
struct emacs_tty old_tty;
timer_ef = get_timer_event_flag ();
/* LIB$GET_EF (&timer_ef); */
SYS$CLREF (timer_ef);
+#if 0
if (!process_ef)
{
LIB$GET_EF (&process_ef);
}
if (input_ef / 32 != process_ef / 32)
croak ("Input and process event flags in different clusters.");
+#endif
if (input_ef / 32 != timer_ef / 32)
- croak ("Input and process event flags in different clusters.");
+ croak ("Input and timer event flags in different clusters.");
+#if 0
input_eflist = ((unsigned) 1 << (input_ef % 32)) |
((unsigned) 1 << (process_ef % 32));
+#endif
timer_eflist = ((unsigned) 1 << (input_ef % 32)) |
((unsigned) 1 << (timer_ef % 32));
#ifndef VMS4_4
{
tty = old_tty;
-#ifdef HAVE_TERMIO
+#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
tty.main.c_iflag |= (IGNBRK); /* Ignore break condition */
tty.main.c_iflag &= ~ICRNL; /* Disable map of CR to NL on input */
#ifdef ISTRIP
#endif
tty.main.c_lflag &= ~ECHO; /* Disable echo */
tty.main.c_lflag &= ~ICANON; /* Disable erase/kill processing */
+#ifdef IEXTEN
+ tty.main.c_iflag &= ~IEXTEN; /* Disable other editing characters. */
+#endif
tty.main.c_lflag |= ISIG; /* Enable signals */
if (flow_control)
{
tty.main.c_cc[VMIN] = 1; /* Input should wait for at least 1 char */
tty.main.c_cc[VTIME] = 0; /* no matter how long that takes. */
#ifdef VSWTCH
- tty.main.c_cc[VSWTCH] = CDEL; /* Turn off shell layering use
+ tty.main.c_cc[VSWTCH] = CDISABLE; /* Turn off shell layering use
of C-z */
#endif /* VSWTCH */
#if defined (mips) || defined (HAVE_TCATTR)
- /* The following code looks like the right thing in general,
- but it is said to cause a crash on USG V.4.
- Let's play safe by turning it on only for the MIPS. */
#ifdef VSUSP
- tty.main.c_cc[VSUSP] = CDEL; /* Turn off mips handling of C-z. */
+ tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off mips handling of C-z. */
#endif /* VSUSP */
#ifdef V_DSUSP
- tty.main.c_cc[V_DSUSP] = CDEL; /* Turn off mips handling of C-y. */
+ tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off mips handling of C-y. */
#endif /* V_DSUSP */
+#ifdef VDSUSP /* Some systems have VDSUSP, some have V_DSUSP. */
+ tty.main.c_cc[VDSUSP] = CDISABLE;
+#endif /* VDSUSP */
#endif /* mips or HAVE_TCATTR */
#ifdef AIX
#ifndef IBMR2AIX
#ifdef VMS
tty.main.tt_char |= TT$M_NOECHO;
if (meta_key)
- tty.main.tt_char |= TT$M_EIGHTBIT
+ tty.main.tt_char |= TT$M_EIGHTBIT;
if (flow_control)
tty.main.tt_char |= TT$M_TTSYNC;
else
queue_kbd_input ()
{
int status;
+ extern kbd_input_ast ();
+
waiting_for_ast = 0;
stop_input = 0;
status = SYS$QIO (0, input_fd, IO$_READVBLK,
{
struct input_event e;
e.kind = ascii_keystroke;
- XSET (buf[i].code, Lisp_Int, cbuf[i]);
- e.frame = selected_frame;
+ XSET (e.code, Lisp_Int, c);
+#ifdef MULTI_FRAME
+ XSET(e.frame_or_window, Lisp_Frame, selected_frame);
+#else
+ e.frame_or_window = Qnil;
+#endif
kbd_buffer_store_event (&e);
}
-
if (input_available_clear_time)
EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
errno = old_errno;
{
#ifdef DATA_START
return ((char *) DATA_START);
+#else
+#ifdef ORDINARY_LINK
+ /*
+ * This is a hack. Since we're not linking crt0.c or pre_crt0.c,
+ * data_start isn't defined. We take the address of environ, which
+ * is known to live at or near the start of the system crt0.c, and
+ * we don't sweat the handful of bytes that might lose.
+ */
+ extern char **environ;
+
+ return((char *) &environ);
#else
extern int data_start;
return ((char *) &data_start);
-#endif
+#endif /* ORDINARY_LINK */
+#endif /* DATA_START */
}
#endif /* NEED_STARTS (not CANNOT_DUMP or not SYSTEM_MALLOC) */
#include <whoami.h>
#endif
+/* Can't have this within the function since `static' is #defined to
+ nothing for some USG systems. */
#ifdef USG
-/* Can't have this within the function since `static' is #defined to nothing */
+#ifdef HAVE_GETHOSTNAME
+static char get_system_name_name[256];
+#else /* not HAVE_GETHOSTNAME */
static struct utsname get_system_name_name;
-#endif
+#endif /* not HAVE_GETHOSTNAME */
+#endif /* USG */
+
+#ifndef BSD4_1
+#ifndef USG
+#ifndef VMS
+#ifdef HAVE_SOCKETS
+#include <sys/socket.h>
+#include <netdb.h>
+#endif /* HAVE_SOCKETS */
+#endif /* not VMS */
+#endif /* not USG */
+#endif /* not BSD4_1 */
char *
get_system_name ()
{
#ifdef USG
+#ifdef HAVE_GETHOSTNAME
+ gethostname (get_system_name_name, sizeof (get_system_name_name));
+ return get_system_name_name;
+#else /* not HAVE_GETHOSTNAME */
uname (&get_system_name_name);
return (get_system_name_name.nodename);
+#endif /* not HAVE_GETHOSTNAME */
#else /* Not USG */
#ifdef BSD4_1
return sysname;
strcpy (system_name_saved, sp);
#else /* not VMS */
gethostname (system_name_saved, sizeof (system_name_saved));
+#ifdef HAVE_SOCKETS
+ /* Turn the hostname into the official, fully-qualified hostname.
+ Don't do this if we're going to dump; this can confuse system
+ libraries on some machines and make the dumped emacs core dump. */
+#ifndef CANNOT_DUMP
+ if (initialized)
+#endif /* not CANNOT_DUMP */
+ {
+ struct hostent *hp;
+ hp = gethostbyname (system_name_saved);
+ if (hp && strlen (hp->h_name) < sizeof(system_name_saved))
+ strcpy (system_name_saved, hp->h_name);
+ }
+#endif /* HAVE_SOCKETS */
#endif /* not VMS */
return system_name_saved;
#endif /* not USG, not 4.1 */
#endif /* not USG */
}
+
+#ifdef VMS
+#ifndef HAVE_GETHOSTNAME
+void gethostname(buf, len)
+ char *buf;
+ int len;
+{
+ char *s;
+ s = getenv ("SYS$NODE");
+ if (s == NULL)
+ buf[0] = '\0';
+ else {
+ strncpy (buf, s, len - 2);
+ buf[len - 1] = '\0';
+ } /* else */
+} /* static void gethostname */
+#endif /* ! HAVE_GETHOSTNAME */
+#endif /* VMS */
+
\f
#ifndef VMS
#ifndef HAVE_SELECT
/* Scan the chars for C-g and store them in kbd_buffer. */
e.kind = ascii_keystroke;
- e.frame = selected_frame;
+ e.frame_or_window = selected_frame;
+ e.modifiers = 0;
for (i = 0; i < nread; i++)
{
XSET (e.code, Lisp_Int, buf[i]);
#endif /* not VMS */
\f
#ifdef BSD4_1
-/* VARARGS */
-setpriority ()
-{
- return 0;
-}
-
/*
* Partially emulate 4.2 open call.
* open is defined as this in 4.1.
init_signals ()
{
-#ifdef POSIX_SIGNALS
- sigemptyset (&signal_empty_mask);
- sigfillset (&signal_full_mask);
-#endif
+ sigemptyset (&empty_mask);
+ sigfillset (&full_mask);
}
-int (*signal_handler_t) ();
-
signal_handler_t
sys_signal (int signal_number, signal_handler_t action)
{
}
#endif /* not BSTRING */
\f
+#ifndef HAVE_RANDOM
#ifdef USG
/*
* The BSD random returns numbers in the range of
srand (arg);
}
#endif /* BSD4_1 */
+#endif
\f
#ifdef WRONG_NAME_INSQUE
d_name.dsc$w_length = strlen (name);
d_name.dsc$a_pointer = name;
- if (lib$sys_trnlog (&d_name, &eqlen, &equiv) == 1)
+ if (LIB$SYS_TRNLOG (&d_name, &eqlen, &equiv) == 1)
{
char *str = (char *) xmalloc (eqlen + 1);
bcopy (buf, str, eqlen);
* always negligible. Fred Fish, Unisoft Systems Inc.
*/
+#ifndef HAVE_SYS_SIGLIST
char *sys_siglist[NSIG + 1] =
{
#ifdef AIX
#endif /* not AIX */
0
};
+#endif HAVE_SYS_SIGLIST
/*
* Warning, this function may not duplicate 4.2 action properly
char *npath, *spath;
extern char *getcwd ();
+ BLOCK_INPUT; /* getcwd uses malloc */
spath = npath = getcwd ((char *) 0, MAXPATHLEN);
/* On Altos 3068, getcwd can return @hostname/dir, so discard
up to first slash. Should be harmless on other systems. */
npath++;
strcpy (pathname, npath);
free (spath); /* getcwd uses malloc */
+ UNBLOCK_INPUT;
return pathname;
}
#endif
-/* Set priority value to PRIO. */
-
-int
-setpriority (which, who, prio)
- int which, who, prio;
-{
- int nice ();
-
- nice (prio - nice (0));
- return (0);
-}
-
#ifndef HAVE_VFORK
/*
register DIR *dirp; /* stream from opendir */
{
sys_close (dirp->dd_fd);
- free ((char *) dirp->dd_buf); /* directory block defined in <dirent.h> */
- free ((char *) dirp);
+ xfree ((char *) dirp->dd_buf); /* directory block defined in <dirent.h> */
+ xfree ((char *) dirp);
}
#endif /* not AIX */
#endif /* SYSV_SYSTEM_DIR */
if (fd < 0)
return 0;
+ BLOCK_INPUT;
if (fstat (fd, &sbuf) < 0
|| (sbuf.st_mode & S_IFMT) != S_IFDIR
|| (dirp = (DIR *) malloc (sizeof (DIR))) == 0)
{
sys_close (fd);
+ UNBLOCK_INPUT;
return 0; /* bad luck today */
}
+ UNBLOCK_INPUT;
dirp->dd_fd = fd;
dirp->dd_loc = dirp->dd_size = 0; /* refill needed */
register DIR *dirp; /* stream from opendir */
{
sys_close (dirp->dd_fd);
- free ((char *) dirp);
+ xfree ((char *) dirp);
}
#define WRITEABLE(field) (! ((xab.xab$w_pro >> field) & XAB$M_NOWRITE))
/* Find privilege bits */
- status = sys$setprv (0, 0, 0, prvmask);
+ status = SYS$SETPRV (0, 0, 0, prvmask);
if (! (status & 1))
error ("Unable to find privileges: %s", vmserrstr (status));
if (CHECKPRIV (PRV$V_BYPASS))
xab = cc$rms_xabpro;
xab.xab$l_aclbuf = aclbuf;
xab.xab$w_aclsiz = sizeof (aclbuf);
- status = sys$open (&fab, 0, 0);
+ status = SYS$OPEN (&fab, 0, 0);
if (! (status & 1))
return -1;
- sys$close (&fab, 0, 0);
+ SYS$CLOSE (&fab, 0, 0);
/* Check system access */
if (CHECKPRIV (PRV$V_SYSPRV) && WRITEABLE (XAB$V_SYS))
return 0;
char *pathname;
{
char *ptr;
- strcpy (pathname, egetenv ("PATH"));
+ extern char *getcwd ();
- ptr = pathname;
- while (*ptr)
- {
- if ('a' <= *ptr && *ptr <= 'z')
- *ptr -= 040;
- ptr++;
- }
- return pathname;
+#define MAXPATHLEN 1024
+
+ ptr = xmalloc (MAXPATHLEN);
+ getcwd (ptr, MAXPATHLEN);
+ strcpy (pathname, ptr);
+ xfree (ptr);
+
+ return pathname;
}
getppid ()
xabpro.xab$l_aclbuf = aclbuf;
xabpro.xab$w_aclsiz = sizeof aclbuf;
/* Call $OPEN to fill in the fab & xabpro fields. */
- if (sys$open (&fab, 0, 0) & 1)
+ if (SYS$OPEN (&fab, 0, 0) & 1)
{
- sys$close (&fab, 0, 0);
+ SYS$CLOSE (&fab, 0, 0);
fab.fab$l_alq = 0; /* zero the allocation quantity */
if (xabpro.xab$w_acllen > 0)
{
{
xabpro.xab$l_aclbuf = (char *) alloca (xabpro.xab$w_acllen);
xabpro.xab$w_aclsiz = xabpro.xab$w_acllen;
- if (sys$open (&fab, 0, 0) & 1)
- sys$close (&fab, 0, 0);
+ if (SYS$OPEN (&fab, 0, 0) & 1)
+ SYS$CLOSE (&fab, 0, 0);
else
old = 0;
}
if (old)
fab_final_pro = xabpro.xab$w_pro;
else
- sys$setdfprot (0, &fab_final_pro);
+ SYS$SETDFPROT (0, &fab_final_pro);
xabpro.xab$w_pro &= 0xff0f; /* set O:rewd for now. This is set back later. */
/* Create the new file with either default attrs or attrs copied
from old file. */
if (!(SYS$CREATE (&fab, 0, 0) & 1))
return -1;
- sys$close (&fab, 0, 0);
+ SYS$CLOSE (&fab, 0, 0);
/* As this is a "replacement" for creat, return a file descriptor
opened for writing. */
return open (new, O_WRONLY);
/* This gibberish opens the file, positions to the first record, and
deletes all records from there until the end of file. */
- if ((sys$open (&xfab) & 01) == 01)
+ if ((SYS$OPEN (&xfab) & 01) == 01)
{
- if ((sys$connect (&xrab) & 01) == 01 &&
- (sys$find (&xrab) & 01) == 01 &&
- (sys$truncate (&xrab) & 01) == 01)
+ if ((SYS$CONNECT (&xrab) & 01) == 01 &&
+ (SYS$FIND (&xrab) & 01) == 01 &&
+ (SYS$TRUNCATE (&xrab) & 01) == 01)
status = 0;
else
status = -1;
}
else
status = -1;
- sys$close (&xfab);
+ SYS$CLOSE (&xfab);
return status;
}
/* initialize rab fields */
uaf_rab.rab$l_fab = &uaf_fab;
/* open the User Authorization File */
- status = sys$open (&uaf_fab);
+ status = SYS$OPEN (&uaf_fab);
if (!(status&1))
{
errno = EVMSERR;
vaxc$errno = status;
return 0;
}
- status = sys$connect (&uaf_rab);
+ status = SYS$CONNECT (&uaf_rab);
if (!(status&1))
{
errno = EVMSERR;
uaf_rab.rab$b_rac = RAB$C_KEY;
uaf_rab.rab$l_ubf = (char *)&retuaf;
uaf_rab.rab$w_usz = sizeof retuaf;
- status = sys$get (&uaf_rab);
+ status = SYS$GET (&uaf_rab);
if (!(status&1))
{
errno = EVMSERR;
return 0;
}
/* close the User Authorization File */
- status = sys$disconnect (&uaf_rab);
+ status = SYS$DISCONNECT (&uaf_rab);
if (!(status&1))
{
errno = EVMSERR;
vaxc$errno = status;
return 0;
}
- status = sys$close (&uaf_fab);
+ status = SYS$CLOSE (&uaf_fab);
if (!(status&1))
{
errno = EVMSERR;
/* initialize rab fields */
uaf_rab.rab$l_fab = &uaf_fab;
/* open the User Authorization File */
- status = sys$open (&uaf_fab);
+ status = SYS$OPEN (&uaf_fab);
if (!(status&1))
{
errno = EVMSERR;
vaxc$errno = status;
return 0;
}
- status = sys$connect (&uaf_rab);
+ status = SYS$CONNECT (&uaf_rab);
if (!(status&1))
{
errno = EVMSERR;
uaf_rab.rab$b_rac = RAB$C_KEY;
uaf_rab.rab$l_ubf = (char *)&retuaf;
uaf_rab.rab$w_usz = sizeof retuaf;
- status = sys$get (&uaf_rab);
+ status = SYS$GET (&uaf_rab);
if (!(status&1))
{
errno = EVMSERR;
return 0;
}
/* close the User Authorization File */
- status = sys$disconnect (&uaf_rab);
+ status = SYS$DISCONNECT (&uaf_rab);
if (!(status&1))
{
errno = EVMSERR;
vaxc$errno = status;
return 0;
}
- status = sys$close (&uaf_fab);
+ status = SYS$CLOSE (&uaf_fab);
if (!(status&1))
{
errno = EVMSERR;
ulimit ()
{}
-setpriority ()
-{}
-
setpgrp ()
{}
to_fab.fab$b_fns = strlen (vms_file_written);
/* Now set the file protection to the correct value */
- sys$open (&to_fab, 0, 0); /* This fills in the nam$w_fid fields */
+ SYS$OPEN (&to_fab, 0, 0); /* This fills in the nam$w_fid fields */
/* Copy these fields into the fib */
fib.fib$r_fid_overlay.fib$w_fid[0] = to_nam.nam$w_fid[0];
fib.fib$r_fid_overlay.fib$w_fid[1] = to_nam.nam$w_fid[1];
fib.fib$r_fid_overlay.fib$w_fid[2] = to_nam.nam$w_fid[2];
- sys$close (&to_fab, 0, 0);
+ SYS$CLOSE (&to_fab, 0, 0);
- stat = sys$assign (&disk, &chan, 0, 0); /* open a channel to the disk */
+ stat = SYS$ASSIGN (&disk, &chan, 0, 0); /* open a channel to the disk */
if (!stat)
- lib$signal (stat);
- stat = sys$qiow (0, chan, IO$_MODIFY, iosb, 0, 0, &fib_d,
+ LIB$SIGNAL (stat);
+ stat = SYS$QIOW (0, chan, IO$_MODIFY, iosb, 0, 0, &fib_d,
0, 0, 0, &fib_attr, 0);
if (!stat)
- lib$signal (stat);
- stat = sys$dassgn (chan);
+ LIB$SIGNAL (stat);
+ stat = SYS$DASSGN (chan);
if (!stat)
- lib$signal (stat);
+ LIB$SIGNAL (stat);
strcpy (vms_file_written, to_esn); /* We will write this to the terminal*/
return 0;
}