]> rtime.felk.cvut.cz Git - orte.git/blobdiff - orte/examples/rtems-shell/orte_rtems_shell.c
Reformat the sources with orte/uncrustify script
[orte.git] / orte / examples / rtems-shell / orte_rtems_shell.c
index f97be56295d2edb4870412b4c575699b95320992..bbbbf1dec0d7754208e74439dbb8c23b773ce96d 100644 (file)
@@ -16,11 +16,12 @@ typedef struct orte_spawn_args {
   char *argv[];
 } orte_spawn_args_t;
 
-void *orte_spawn_task_func(void *arg_pack)
+void *
+orte_spawn_task_func(void *arg_pack)
 {
-  rtems_shell_cmd_tshell_cmd;
+  rtems_shell_cmd_t *shell_cmd;
   int                errorlevel = 0;
-  orte_spawn_args_t  *spawn_args = (orte_spawn_args_t*)arg_pack;
+  orte_spawn_args_t  *spawn_args = (orte_spawn_args_t *)arg_pack;
   int                argc = spawn_args->argc;
   char               **argv = &(spawn_args->argv[0]);
 
@@ -29,9 +30,9 @@ void *orte_spawn_task_func(void *arg_pack)
 
   if (argc) {
     shell_cmd = rtems_shell_lookup_cmd(argv[0]);
-    if ( argv[1] == NULL ) {
+    if (argv[1] == NULL) {
       errorlevel = -1;
-    } else if ( shell_cmd == NULL ) {
+    } else if (shell_cmd == NULL) {
       errorlevel = rtems_shell_script_file(argc, &argv[0]);
     } else {
       errorlevel = shell_cmd->command(argc, &argv[0]);
@@ -39,10 +40,11 @@ void *orte_spawn_task_func(void *arg_pack)
   }
 
   free(arg_pack);
-  return (void*)errorlevel;
+  return (void *)errorlevel;
 }
 
-int orte_spawn_main(int argc, char **argv)
+int
+orte_spawn_main(int argc, char **argv)
 {
   orte_spawn_args_t  *spawn_args;
   int       sparg_size;
@@ -55,25 +57,25 @@ int orte_spawn_main(int argc, char **argv)
   argv++;
   argc--;
 
-  sparg_str_offs = sizeof(orte_spawn_args_t) + (argc + 1) *sizeof(char*);
+  sparg_str_offs = sizeof(orte_spawn_args_t) + (argc + 1) *sizeof(char *);
   sparg_size = sparg_str_offs;
 
   for (i = 0; i < argc; i++)
-     sparg_size += strlen(argv[i]) + 1;
+    sparg_size += strlen(argv[i]) + 1;
 
   spawn_args = malloc(sparg_size);
   if (spawn_args == NULL)
-     return 1;
+    return 1;
 
   spawn_args->argc = argc;
 
-  p = (char*)spawn_args + sparg_str_offs;
+  p = (char *)spawn_args + sparg_str_offs;
   for (i = 0; i < argc; i++) {
-     int len = strlen(argv[i]);
-     spawn_args->argv[i] = p;
-     memcpy(p, argv[i], len);
-     p += len;
-     *(p++) = 0;
+    int len = strlen(argv[i]);
+    spawn_args->argv[i] = p;
+    memcpy(p, argv[i], len);
+    p += len;
+    *(p++) = 0;
   }
   spawn_args->argv[argc] = NULL;
 
@@ -81,5 +83,5 @@ int orte_spawn_main(int argc, char **argv)
   if (status == 0)
     pthread_detach(task_id);
 
-  return status?1:0;
+  return status ? 1 : 0;
 }