/* "Hello world" program for GNU C Library on bare Mach 3.0.
-Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
-#include <ansidecl.h>
#include <mach.h>
-#include <mach/device.h>
+#include <device/device.h>
#include <errno.h>
-
-extern FILE *mach_open_devstream (device_t dev);
+#include <stdio.h>
int
-main (int argc, char **argv, char **envp)
+main (void)
{
- error_t err;
+ kern_return_t err;
mach_port_t device, consdev;
FILE *consf;
- device = pid2task (-2);
+ err = get_privileged_ports (NULL, &device);
+ if (err)
+ _exit (err);
err = device_open (device, D_WRITE, "console", &consdev);
mach_port_deallocate (mach_task_self (), device);
if (err)
- exit (err);
+ _exit (err);
- consf = mach_open_devstream (consdev);
+ consf = mach_open_devstream (consdev, "w");
if (consf == NULL)
exit (errno);