Subversion Repositories HelenOS

Rev

Rev 3277 | Rev 3319 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3311 post 1
/* Automatically generated by mknewcmd on Wed Aug 13 15:41:09 PHT 2008
3277 post 2
 * This is machine generated output. The author of mknewcmd claims no
3
 * copyright over the contents of this file. Where legally permitted, the
4
 * contents herein are donated to the public domain.
5
 *
6
 * You should apply any license and copyright that you wish to this file,
7
 * replacing this header in its entirety. */
8
 
9
#include <stdio.h>
10
#include <stdlib.h>
3311 post 11
#include "config.h"
12
#include "util.h"
13
#include "errors.h"
3277 post 14
#include "entry.h"
15
#include "cat.h"
16
#include "cmds.h"
17
 
18
static char *cmdname = "cat";
19
 
20
/* Dispays help for cat in various levels */
21
void * help_cmd_cat(unsigned int level)
22
{
23
    printf("This is the %s help for '%s'.\n",
24
        level ? EXT_HELP : SHORT_HELP, cmdname);
3311 post 25
    return CMD_VOID;
3277 post 26
}
27
 
28
/* Main entry point for cat, accepts an array of arguments */
29
int * cmd_cat(char **argv)
30
{
31
    unsigned int argc;
32
    unsigned int i;
33
 
34
    /* Count the arguments */
35
    for (argc = 0; argv[argc] != NULL; argc ++);
36
 
37
    printf("%s %s\n", TEST_ANNOUNCE, cmdname);
38
    printf("%d arguments passed to %s", argc - 1, cmdname);
39
 
40
    if (argc < 2) {
41
        printf("\n");
3311 post 42
        return CMD_SUCCESS;
3277 post 43
    }
44
 
45
    printf(":\n");
46
    for (i = 1; i < argc; i++)
47
        printf("[%d] -> %s\n", i, argv[i]);
48
 
3311 post 49
    return CMD_SUCCESS;
3277 post 50
}
51