source: rtems/c/src/lib/libbsp/shared/bspinit.c @ 6273201

4.115
Last change on this file since 6273201 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2009.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 */
9
10#include <stdlib.h>
11#include <string.h>
12
13#include <bsp.h>
14#include <bsp/bootcard.h>
15#ifdef RTEMS_NETWORKING
16  #include <rtems/rtems_bsdnet.h>
17#endif
18
19/*
20 * This routine calls main from a confdefs.h default Init task
21 * set up. The bootcard will provide the task argument as
22 * command line string (ASCIIZ).
23 */
24
25int main (int argc, char* argv[]);
26
27void Init (rtems_task_argument arg)
28{
29  const char* boot_cmdline = *((const char**) arg);
30  char*       cmdline = 0;
31  char*       command;
32  int         argc = 0;
33  char**      argv = NULL;
34  int         result = -124;
35
36  if (boot_cmdline)
37  {
38    cmdline = malloc (strlen (boot_cmdline) + 1);
39
40    if (cmdline)
41    {
42      strcpy (cmdline, boot_cmdline);
43
44      command = cmdline;
45
46      /*
47       * Break the line up into arguments with "" being ignored.
48       */
49      while (true)
50      {
51        command = strtok (command, " \t\r\n");
52        if (command == NULL)
53          break;
54        argc++;
55        command = '\0';
56      }
57
58      argv = calloc (argc, sizeof (char*));
59
60      if (argv)
61      {
62        int a;
63
64        command = cmdline;
65        argv[0] = command;
66
67        for (a = 1; a < argc; a++)
68        {
69          command += strlen (command) + 1;
70          argv[a] = command;
71        }
72      }
73      else
74        argc = 0;
75    }
76  }
77
78#ifdef RTEMS_NETWORKING
79  rtems_bsdnet_initialize_network ();
80#endif
81
82  result = main (argc, argv);
83
84  free (argv);
85  free (cmdline);
86
87  exit (result);
88}
89
90/*
91 * By making this a weak alias and a user can provide there own.
92 */
93
94void Init (rtems_task_argument arg) __attribute__ ((weak));
Note: See TracBrowser for help on using the repository browser.