~jakub/helenos/upa

« back to all changes in this revision

Viewing changes to uspace/app/bdsh/cmds/modules/mount/mount.c

  • Committer: Jakub Jermar
  • Date: 2011-05-12 16:49:44 UTC
  • mfrom: (605.1.334 mainline)
  • Revision ID: jakub@jermar.eu-20110512164944-lf0mddwtjbz3od1h
MergeĀ mainlineĀ changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include <stdlib.h>
31
31
#include <vfs/vfs.h>
32
32
#include <errno.h>
 
33
#include <getopt.h>
33
34
#include "config.h"
34
35
#include "util.h"
35
36
#include "errors.h"
39
40
 
40
41
static const char *cmdname = "mount";
41
42
 
42
 
/* Dispays help for mount in various levels */
 
43
static struct option const long_options[] = {
 
44
        { "help", no_argument, 0, 'h' },
 
45
        { 0, 0, 0, 0 }
 
46
};
 
47
 
 
48
 
 
49
/* Displays help for mount in various levels */
43
50
void help_cmd_mount(unsigned int level)
44
51
{
45
52
        static char helpfmt[] =
58
65
{
59
66
        unsigned int argc;
60
67
        const char *mopts = "";
61
 
        int rc;
 
68
        int rc, c, opt_ind;
62
69
 
63
70
        argc = cli_count_args(argv);
64
71
 
 
72
        for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
 
73
                c = getopt_long(argc, argv, "h", long_options, &opt_ind);
 
74
                switch (c) {
 
75
                case 'h':
 
76
                        help_cmd_mount(HELP_LONG);
 
77
                        return CMD_SUCCESS;
 
78
                }
 
79
        }
 
80
 
65
81
        if ((argc < 4) || (argc > 5)) {
66
 
                printf("%s: invalid number of arguments.\n",
 
82
                printf("%s: invalid number of arguments. Try `mount --help'\n",
67
83
                    cmdname);
68
84
                return CMD_FAILURE;
69
85
        }