/*
 * runlevel: return the current runlevel (by peeking at the commandline
 *           of /sbin/init)
 *
 *  Copyright (c) 2000 David Parsons. All rights reserved.
 *
 *  This software is released under a berkeley-style copyright; the
 *  details can be found in the file COPYRIGHT.
 */

#include <stdio.h>
#include <unistd.h>
#include "init.h"

/*
 * get the runlevel out of the command line.  Works on linux and FreeBSD
 */
void
main(int argc, char ** argv)
{
    char *run = get_runlevel();

    if (*run) {
	printf("%c\n", *run);
	exit(0);
    }
    exit(1);
} /* runlevel */
