Changeset 8e81a7e in mainline
- Timestamp:
- 2012-04-01T17:45:39Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 087c27f6
- Parents:
- 1ffd74e
- Location:
- uspace/app/bdsh
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/TODO
r1ffd74e r8e81a7e 30 30 * Add wrappers for signal, sigaction to make ports to modules easier 31 31 32 * Add 'echo' and 'printf' modules.33 34 32 Regarding POSIX: 35 33 ---------------- -
uspace/app/bdsh/cmds/modules/printf/printf.c
r1ffd74e r8e81a7e 59 59 60 60 61 static voidprint_arg(wchar_t ch, const char* arg)61 static int print_arg(wchar_t ch, const char* arg) 62 62 { 63 63 switch(ch) { … … 72 72 break; 73 73 default: 74 return ;74 return CMD_FAILURE; 75 75 } 76 return CMD_SUCCESS; 76 77 } 77 78 78 static voidprocess_esc(wchar_t ch)79 static int process_esc(wchar_t ch) 79 80 { 80 81 switch(ch) { … … 83 84 break; 84 85 default: 85 return ;86 return CMD_FAILURE; 86 87 } 88 return CMD_SUCCESS; 87 89 } 88 90 89 91 90 /* Main entry point for printf, accepts an array of arguments */ 92 /* Prints formatted data. 93 * Accepted format flags: 94 * %d - print an integer 95 * %u - print an unsigned integer 96 * %s - print a null terminated string 97 ***** 98 * Accepted output controls: 99 * \n - new line 100 */ 91 101 int cmd_printf(char **argv) 92 102 { … … 96 106 wchar_t ch; 97 107 bool esc_flag = false; 98 unsigned int carg; 108 unsigned int carg; // Current argument 99 109 100 110 /* Count the arguments */ … … 128 138 break; 129 139 } 140 if (carg == argc) { 141 printf("\nBad parameter number. Aborted.\n"); 142 return CMD_FAILURE; 143 } 130 144 print_arg(ch, argv[carg]); 131 145 ++carg;
Note:
See TracChangeset
for help on using the changeset viewer.