@@ -1868,6 +1868,10 @@ static const char * const convert_usage[] = {
1868
1868
OPTLINE ("-O|--features LIST" , "comma separated list of filesystem features" ),
1869
1869
OPTLINE ("--no-progress" , "show only overview, not the detailed progress" ),
1870
1870
"" ,
1871
+ "General:" ,
1872
+ OPTLINE ("--version" , "print the btrfs-convert version and exit" ),
1873
+ OPTLINE ("--help" , "print this help and exit" ),
1874
+ "" ,
1871
1875
"Supported filesystems:" ,
1872
1876
"\text2/3/4: "
1873
1877
#if BTRFSCONVERT_EXT2
@@ -1910,11 +1914,10 @@ int BOX_MAIN(convert)(int argc, char *argv[])
1910
1914
cpu_detect_flags ();
1911
1915
hash_init_accel ();
1912
1916
btrfs_assert_feature_buf_size ();
1913
- printf ("btrfs-convert from %s\n\n" , PACKAGE_STRING );
1914
1917
1915
1918
while (1 ) {
1916
1919
enum { GETOPT_VAL_NO_PROGRESS = GETOPT_VAL_FIRST , GETOPT_VAL_CHECKSUM ,
1917
- GETOPT_VAL_UUID };
1920
+ GETOPT_VAL_UUID , GETOPT_VAL_VERSION };
1918
1921
static const struct option long_options [] = {
1919
1922
{ "no-progress" , no_argument , NULL ,
1920
1923
GETOPT_VAL_NO_PROGRESS },
@@ -1932,7 +1935,8 @@ int BOX_MAIN(convert)(int argc, char *argv[])
1932
1935
{ "copy-label" , no_argument , NULL , 'L' },
1933
1936
{ "uuid" , required_argument , NULL , GETOPT_VAL_UUID },
1934
1937
{ "nodesize" , required_argument , NULL , 'N' },
1935
- { "help" , no_argument , NULL , GETOPT_VAL_HELP },
1938
+ { "help" , no_argument , NULL , GETOPT_VAL_HELP },
1939
+ { "version" , no_argument , NULL , GETOPT_VAL_VERSION },
1936
1940
{ NULL , 0 , NULL , 0 }
1937
1941
};
1938
1942
int c = getopt_long (argc , argv , "dinN:rl:LpO:" , long_options , NULL );
@@ -2024,11 +2028,18 @@ int BOX_MAIN(convert)(int argc, char *argv[])
2024
2028
strncpy_null (fsid , optarg , sizeof (fsid ));
2025
2029
}
2026
2030
break ;
2031
+ case GETOPT_VAL_VERSION :
2032
+ printf ("btrfs-convert, part of %s\n" , PACKAGE_STRING );
2033
+ ret = 0 ;
2034
+ goto success ;
2027
2035
case GETOPT_VAL_HELP :
2028
2036
default :
2029
2037
usage (& convert_cmd , c != GETOPT_VAL_HELP );
2030
2038
}
2031
2039
}
2040
+
2041
+ printf ("btrfs-convert from %s\n\n" , PACKAGE_STRING );
2042
+
2032
2043
set_argv0 (argv );
2033
2044
if (check_argc_exact (argc - optind , 1 )) {
2034
2045
usage (& convert_cmd , 1 );
@@ -2072,5 +2083,6 @@ int BOX_MAIN(convert)(int argc, char *argv[])
2072
2083
}
2073
2084
if (ret )
2074
2085
return 1 ;
2086
+ success :
2075
2087
return 0 ;
2076
2088
}
0 commit comments