From d7ca4997017e86b6f23ced64f1f1672bfb15716b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 24 Feb 2009 16:58:33 +0100 Subject: s3:mount.cifs: make "mount.cifs -V" print the version, not usage. Also make "mount.cifs -h" not exit with error exit code but with return code 0. Michael --- source3/client/mount.cifs.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'source3/client') diff --git a/source3/client/mount.cifs.c b/source3/client/mount.cifs.c index 641584947f..ae8a7fd186 100644 --- a/source3/client/mount.cifs.c +++ b/source3/client/mount.cifs.c @@ -1016,6 +1016,14 @@ uppercase_string(char *string) return 1; } +static void print_cifs_mount_version(void) +{ + printf("mount.cifs version: %s.%s%s\n", + MOUNT_CIFS_VERSION_MAJOR, + MOUNT_CIFS_VERSION_MINOR, + MOUNT_CIFS_VENDOR_SUFFIX); +} + int main(int argc, char ** argv) { int c; @@ -1077,6 +1085,24 @@ int main(int argc, char ** argv) exit(EX_SYSERR); } mountpoint = argv[2]; + } else if (argc == 2) { + if ((strcmp(argv[1], "-V") == 0) || + (strcmp(argv[1], "--version") == 0)) + { + print_cifs_mount_version(); + exit(0); + } + + if ((strcmp(argv[1], "-h") == 0) || + (strcmp(argv[1], "-?") == 0) || + (strcmp(argv[1], "--help") == 0)) + { + mount_cifs_usage(); + exit(0); + } + + mount_cifs_usage(); + exit(EX_USAGE); } else { mount_cifs_usage(); exit(EX_USAGE); @@ -1133,11 +1159,8 @@ int main(int argc, char ** argv) case 'v': ++verboseflag; break; - case 'V': - printf ("mount.cifs version: %s.%s%s\n", - MOUNT_CIFS_VERSION_MAJOR, - MOUNT_CIFS_VERSION_MINOR, - MOUNT_CIFS_VENDOR_SUFFIX); + case 'V': + print_cifs_mount_version(); exit (0); case 'w': flags &= ~MS_RDONLY; -- cgit