Subversion Repositories HelenOS

Rev

Rev 3311 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /* Automatically generated by mknewcmd on Mon Aug 11 00:21:59 PHT 2008
  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>
  11. #include "entry.h"
  12. #include "cat.h"
  13. #include "cmds.h"
  14.  
  15. static char *cmdname = "cat";
  16.  
  17. /* Dispays help for cat in various levels */
  18. void * help_cmd_cat(unsigned int level)
  19. {
  20.     printf("This is the %s help for '%s'.\n",
  21.         level ? EXT_HELP : SHORT_HELP, cmdname);
  22.     return 0;
  23. }
  24.  
  25. /* Main entry point for cat, accepts an array of arguments */
  26. int * cmd_cat(char **argv)
  27. {
  28.     unsigned int argc;
  29.     unsigned int i;
  30.  
  31.     /* Count the arguments */
  32.     for (argc = 0; argv[argc] != NULL; argc ++);
  33.  
  34.     printf("%s %s\n", TEST_ANNOUNCE, cmdname);
  35.     printf("%d arguments passed to %s", argc - 1, cmdname);
  36.  
  37.     if (argc < 2) {
  38.         printf("\n");
  39.         return 0;
  40.     }
  41.  
  42.     printf(":\n");
  43.     for (i = 1; i < argc; i++)
  44.         printf("[%d] -> %s\n", i, argv[i]);
  45.  
  46.     return 0;
  47. }
  48.  
  49.