Changeset 1433ecda in mainline for uspace/app/bdsh/cmds/modules/mkfile/mkfile.c
- Timestamp:
- 2018-04-04T15:42:37Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2c4e1cc
- Parents:
- 47b2d7e3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/mkfile/mkfile.c
r47b2d7e3 r1433ecda 53 53 54 54 static struct option const long_options[] = { 55 { "size", required_argument, 0, 's'},56 { "sparse", no_argument, 0, 'p'},57 { "help", no_argument, 0, 'h'},58 { 0, 0, 0, 0}55 { "size", required_argument, 0, 's' }, 56 { "sparse", no_argument, 0, 'p' }, 57 { "help", no_argument, 0, 'h' }, 58 { 0, 0, 0, 0 } 59 59 }; 60 60 … … 66 66 help_cmd_mkfile(HELP_SHORT); 67 67 printf( 68 "Usage: %s [options] <path>\n"69 "Options:\n"70 " -h, --help A short option summary\n"71 " -s, --size sz Size of the file\n"72 " -p, --sparse Create a sparse file\n"73 "\n"74 "Size is a number followed by 'k', 'm' or 'g' for kB, MB, GB.\n"75 "E.g. 100k, 2m, 1g.\n",76 cmdname);68 "Usage: %s [options] <path>\n" 69 "Options:\n" 70 " -h, --help A short option summary\n" 71 " -s, --size sz Size of the file\n" 72 " -p, --sparse Create a sparse file\n" 73 "\n" 74 "Size is a number followed by 'k', 'm' or 'g' for kB, MB, GB.\n" 75 "E.g. 100k, 2m, 1g.\n", 76 cmdname); 77 77 } 78 78 … … 101 101 102 102 if (ep[1] != '\0') 103 103 return EINVAL; 104 104 105 105 switch (tolower(ep[0])) { 106 case 'k': unit = 1024; break; 107 case 'm': unit = 1024*1024; break; 108 case 'g': unit = 1024*1024*1024; break; 109 default: return EINVAL; 106 case 'k': 107 unit = 1024; 108 break; 109 case 'm': 110 unit = 1024 * 1024; 111 break; 112 case 'g': 113 unit = 1024 * 1024 * 1024; 114 break; 115 default: 116 return EINVAL; 110 117 } 111 118 … … 162 169 if (argc != 1) { 163 170 printf("%s: incorrect number of arguments. Try `%s --help'\n", 164 171 cmdname, cmdname); 165 172 return CMD_FAILURE; 166 173 }
Note:
See TracChangeset
for help on using the changeset viewer.