<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for examples-v2 (2010-05-05)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-05-05 Joel Sherrill <joel.sherrill@oarcorp.com>

        * qemu_vfat/Makefile, qemu_vfat/README, qemu_vfat/init.c: Now includes
        a start_test example which parses arguments.
        * qemu_vfat/start_test.c: New file.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/misc/ChangeLog.diff?r1=text&tr1=1.10&r2=text&tr2=1.11&diff_format=h">M</a></td><td width='1%'>1.11</td><td width='100%'>misc/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/misc/qemu_vfat/Makefile.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>misc/qemu_vfat/Makefile</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/misc/qemu_vfat/README.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>misc/qemu_vfat/README</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/misc/qemu_vfat/init.c.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>misc/qemu_vfat/init.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/misc/qemu_vfat/start_test.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">misc/qemu_vfat/start_test.c</font></td></tr>
</table>
<pre>
<font color='#006600'>diff -u examples-v2/misc/ChangeLog:1.10 examples-v2/misc/ChangeLog:1.11
--- examples-v2/misc/ChangeLog:1.10     Wed May  5 10:06:28 2010
+++ examples-v2/misc/ChangeLog  Wed May  5 10:29:54 2010
</font><font color='#997700'>@@ -1,5 +1,11 @@
</font> 2010-05-05        Joel Sherrill <joel.sherrill@oarcorp.com>
 
<font color='#000088'>+   * qemu_vfat/Makefile, qemu_vfat/README, qemu_vfat/init.c: Now includes
+       a start_test example which parses arguments.
+       * qemu_vfat/start_test.c: New file.
+
+2010-05-05     Joel Sherrill <joel.sherrill@oarcorp.com>
+
</font>   * qemu_vfat/.cvsignore, qemu_vfat/Makefile, qemu_vfat/README,
        qemu_vfat/init.c, qemu_vfat/system.h: New files.
 

<font color='#006600'>diff -u examples-v2/misc/qemu_vfat/Makefile:1.1 examples-v2/misc/qemu_vfat/Makefile:1.2
--- examples-v2/misc/qemu_vfat/Makefile:1.1     Wed May  5 10:06:28 2010
+++ examples-v2/misc/qemu_vfat/Makefile Wed May  5 10:29:54 2010
</font><font color='#997700'>@@ -12,7 +12,7 @@
</font> MANAGERS=all
 
 # C source names
<font color='#880000'>-CSRCS = init.c
</font><font color='#000088'>+CSRCS = init.c start_test.c
</font> COBJS = $(CSRCS:%.c=${ARCH}/%.o)
 
 include $(RTEMS_MAKEFILE_PATH)/Makefile.inc

<font color='#006600'>diff -u examples-v2/misc/qemu_vfat/README:1.1 examples-v2/misc/qemu_vfat/README:1.2
--- examples-v2/misc/qemu_vfat/README:1.1       Wed May  5 10:06:28 2010
+++ examples-v2/misc/qemu_vfat/README   Wed May  5 10:29:54 2010
</font><font color='#997700'>@@ -17,3 +17,4 @@
</font> With this setup, you can copy those test support files into<span style="background-color: #FF0000"> </span>
 the host directory and the RTEMS "main" will use those in
 support of the testing.
<font color='#000088'>+
</font>
<font color='#006600'>diff -u examples-v2/misc/qemu_vfat/init.c:1.1 examples-v2/misc/qemu_vfat/init.c:1.2
--- examples-v2/misc/qemu_vfat/init.c:1.1       Wed May  5 10:06:28 2010
+++ examples-v2/misc/qemu_vfat/init.c   Wed May  5 10:29:54 2010
</font><font color='#997700'>@@ -30,9 +30,10 @@
</font>  * with the "rtems_fsmount" function.
  * See cpukit/libmisc/fsmount for definition of fields
  */
<font color='#000088'>+#define MOUNT_POINT "/mnt/test"
</font> fstab_t fs_table[] = {
   {
<font color='#880000'>-    "/dev/hda1", "/mnt/test",
</font><font color='#000088'>+    "/dev/hda1", MOUNT_POINT,
</font>     &msdos_ops, RTEMS_FILESYSTEM_READ_WRITE,
     FSMOUNT_MNT_OK | FSMOUNT_MNTPNT_CRTERR | FSMOUNT_MNT_FAILED,
     0
<font color='#997700'>@@ -148,6 +149,7 @@
</font>   fileio_start_shell ();
 #endif
 #if defined(USE_START_TEST)
<font color='#000088'>+  chdir( MOUNT_POINT );
</font>   start_test ();
 #endif
   puts( "*** END OF QEMU VFAT AND SHELL TEST ***" );

<font color='#006600'>diff -u /dev/null examples-v2/misc/qemu_vfat/start_test.c:1.1
--- /dev/null   Wed May  5 11:10:03 2010
+++ examples-v2/misc/qemu_vfat/start_test.c     Wed May  5 10:29:54 2010
</font><font color='#997700'>@@ -0,0 +1,91 @@
</font><font color='#000088'>+/*
+ *  Start Test Example
+ *
+ *  $Id$
+ */
+
+#if defined(USE_START_TEST)
+
+#define __need_getopt_newlib
+#include <getopt.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <rtems/shell.h>
+
+#define COMMAND_LINE_ARGUMENTS_FILE "arguments"
+
+#define ARGV_LENGTH 80
+#define ARGV_LIMIT  32
+
+int     Argc;
+char   *Argv[ARGV_LIMIT];
+char    Argv_String[ ARGV_LENGTH ];
+
+void parse_arguments(void)
+{
+  FILE   *in;
+  char   *cStatus;
+  size_t  length;
+  int     sc;
+
+  in = fopen( COMMAND_LINE_ARGUMENTS_FILE, "r" );
+  if ( !in ) {
+    fprintf( stderr, "Unable to open %s\n", COMMAND_LINE_ARGUMENTS_FILE );
+    exit(1);
+  }
+
+  cStatus = fgets( Argv_String, sizeof(Argv_String), in );
+  if ( cStatus == NULL ) {
+    fprintf( stderr, "Unable to read %s\n", COMMAND_LINE_ARGUMENTS_FILE );
+    exit(1);
+  }
+
+  // If the last line does not have a CR, then we don't want to
+  // arbitrarily clobber an = instead of a \n.
+  length = strlen(Argv_String);
+  if ( Argv_String[ length - 1] != '\n' ) {
+    fprintf(
+      stderr,
+      "Line appears to be too long in %s\n",
+      COMMAND_LINE_ARGUMENTS_FILE
+    );
+    exit(1);
+  }
+
+  Argv_String[ length - 1] = '\0';
+
+  sc = rtems_shell_make_args(
+    &Argv_String[0],
+    &Argc,
+    &Argv[1],
+    ARGV_LIMIT - 1
+  );
+  if ( sc ) {
+    fprintf( stderr, "Error parsing arguments\n" );
+    exit(1);
+  }
+
+  /* Since we added the program name ourselves and started at 0 */
+  Argc++;
+  fclose(in);
+}
+
+void print_arguments(void)
+{
+  int i;
+
+  for ( i=0 ; i<Argc ; i++ ) {
+    fprintf( stderr, "argc[%d] = %s\n", i, Argv[i] );
+  }
+
+}
+
+void start_test(void)
+{
+  Argv[0] = "my_program";
+  parse_arguments();
+  print_arguments();
+  /* If this were a real user test, we would invoke the main here */
+}
+#endif
</font></pre>
<p> </p>

<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>