Changeset 46c20c8 in mainline for uspace/app/redir/redir.c


Ignore:
Timestamp:
2010-11-26T20:08:10Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
45df59a
Parents:
fb150d78 (diff), ffdd2b9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/redir/redir.c

    rfb150d78 r46c20c8  
    3939#include <fcntl.h>
    4040#include <unistd.h>
    41 #include <string.h>
     41#include <str.h>
    4242#include <stdio.h>
    4343#include <task.h>
     44#include <str_error.h>
     45#include <errno.h>
     46
     47#define NAME  "redir"
    4448
    4549static void usage(void)
    4650{
    47         printf("Usage: redir [-i <stdin>] [-o <stdout>] [-e <stderr>] -- <cmd> [args ...]\n");
     51        printf("Usage: %s [-i <stdin>] [-o <stdout>] [-e <stderr>] -- <cmd> [args ...]\n",
     52            NAME);
    4853}
    4954
     
    7277static task_id_t spawn(int argc, char *argv[])
    7378{
    74         char **args = (char *) calloc(argc + 1, sizeof(char *));
     79        const char **args;
     80        task_id_t id = 0;
     81        int rc;
     82
     83        args = (const char **) calloc(argc + 1, sizeof(char *));
    7584        if (!args) {
    7685                printf("No memory available\n");
     
    8493        args[argc] = NULL;
    8594       
    86         task_id_t id = task_spawn(argv[0], args);
     95        rc = task_spawnv(&id, argv[0], args);
    8796       
    8897        free(args);
    8998       
    90         if (id == 0)
    91                 printf("Error spawning %s\n", argv[0]);
     99        if (rc != EOK) {
     100                printf("%s: Error spawning %s (%s)\n", NAME, argv[0],
     101                    str_error(rc));
     102        }
    92103       
    93104        return id;
Note: See TracChangeset for help on using the changeset viewer.