summaryrefslogtreecommitdiffstats
path: root/testsuites/samples/pppd/init.c
blob: e8bd7c37cac77c8303c3dd4bd41bd844a59b3ab3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 *  COPYRIGHT (c) 1989-2012.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.org/license/LICENSE.
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#define TEST_INIT

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define CONFIGURE_INIT
#include "system.h"

#include <rtems/rtems_bsdnet.h>
#include <rtems/rtemspppd.h>
#include <rtems/shell.h>
#include "netconfig.h"

const char rtems_test_name[] = "PPPD";
rtems_printer rtems_test_printer;

static void notification(int fd, int seconds_remaining, void *arg)
{
  printf(
    "Press any key to start pppd (%is remaining)\n",
    seconds_remaining
  );
}

rtems_task Init(rtems_task_argument argument)
{
  rtems_status_code status;

  rtems_print_printer_printf(&rtems_test_printer);

  rtems_test_begin();

  status = rtems_shell_wait_for_input(
    STDIN_FILENO,
    10,
    notification,
    NULL
  );
  if (status != RTEMS_SUCCESSFUL) {
    rtems_test_end();
    exit( 0 );
  }

  /* initialize network */
  rtems_bsdnet_initialize_network();
  rtems_pppd_initialize();
  pppdapp_initialize();
  rtems_task_delete(RTEMS_SELF);
}