change log for examples-v2 (2010-05-05)
rtems-vc at rtems.org
rtems-vc at rtems.org
Wed May 5 16:10:04 UTC 2010
*joel*:
2010-05-05 Joel Sherrill <joel.sherrill at 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.
M 1.11 misc/ChangeLog
M 1.2 misc/qemu_vfat/Makefile
M 1.2 misc/qemu_vfat/README
M 1.2 misc/qemu_vfat/init.c
A 1.1 misc/qemu_vfat/start_test.c
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
@@ -1,5 +1,11 @@
2010-05-05 Joel Sherrill <joel.sherrill at 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.
+
+2010-05-05 Joel Sherrill <joel.sherrill at oarcorp.com>
+
* qemu_vfat/.cvsignore, qemu_vfat/Makefile, qemu_vfat/README,
qemu_vfat/init.c, qemu_vfat/system.h: New files.
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
@@ -12,7 +12,7 @@
MANAGERS=all
# C source names
-CSRCS = init.c
+CSRCS = init.c start_test.c
COBJS = $(CSRCS:%.c=${ARCH}/%.o)
include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
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
@@ -17,3 +17,4 @@
With this setup, you can copy those test support files into
the host directory and the RTEMS "main" will use those in
support of the testing.
+
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
@@ -30,9 +30,10 @@
* with the "rtems_fsmount" function.
* See cpukit/libmisc/fsmount for definition of fields
*/
+#define MOUNT_POINT "/mnt/test"
fstab_t fs_table[] = {
{
- "/dev/hda1", "/mnt/test",
+ "/dev/hda1", MOUNT_POINT,
&msdos_ops, RTEMS_FILESYSTEM_READ_WRITE,
FSMOUNT_MNT_OK | FSMOUNT_MNTPNT_CRTERR | FSMOUNT_MNT_FAILED,
0
@@ -148,6 +149,7 @@
fileio_start_shell ();
#endif
#if defined(USE_START_TEST)
+ chdir( MOUNT_POINT );
start_test ();
#endif
puts( "*** END OF QEMU VFAT AND SHELL TEST ***" );
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
@@ -0,0 +1,91 @@
+/*
+ * 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
--
Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20100505/9040df7f/attachment-0001.html>
More information about the vc
mailing list