Changeset a9db9b8 in mainline
- Timestamp:
- 2010-11-14T17:34:19Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 06e2209, 8e189ef
- Parents:
- 9e2e715 (diff), 4deb8b5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/app
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/help/help.c
r9e2e715 ra9db9b8 45 45 extern const char *progname; 46 46 47 #define HELP_IS_MODULE 1 48 #define HELP_IS_BUILTIN 0 49 #define HELP_IS_RUBBISH -1 47 #define HELP_IS_COMMANDS 2 48 #define HELP_IS_MODULE 1 49 #define HELP_IS_BUILTIN 0 50 #define HELP_IS_RUBBISH -1 50 51 51 52 volatile int mod_switch = -1; … … 55 56 { 56 57 int rc = HELP_IS_RUBBISH; 58 59 if (str_cmp(cmd, "commands") == 0) 60 return HELP_IS_COMMANDS; 57 61 58 62 rc = is_builtin(cmd); … … 90 94 } 91 95 92 int cmd_help(char *argv[])96 static void help_commands(void) 93 97 { 98 builtin_t *cmd; 94 99 module_t *mod; 95 builtin_t *cmd; 96 unsigned int i = 0; 97 int rc = 0; 98 int argc; 99 int level = HELP_SHORT; 100 unsigned int i; 100 101 101 argc = cli_count_args(argv); 102 103 if (argc > 3) { 104 printf("\nToo many arguments to `%s', try:\n", cmdname); 105 help_cmd_help(HELP_SHORT); 106 return CMD_FAILURE; 107 } 108 109 if (argc == 3) { 110 if (!str_cmp("extended", argv[2])) 111 level = HELP_LONG; 112 else 113 level = HELP_SHORT; 114 } 115 116 if (argc > 1) { 117 rc = is_mod_or_builtin(argv[1]); 118 switch (rc) { 119 case HELP_IS_RUBBISH: 120 printf("Invalid command %s\n", argv[1]); 121 return CMD_FAILURE; 122 case HELP_IS_MODULE: 123 help_module(mod_switch, level); 124 return CMD_SUCCESS; 125 case HELP_IS_BUILTIN: 126 help_builtin(mod_switch, level); 127 return CMD_SUCCESS; 128 } 129 } 130 131 printf("\n Available commands are:\n"); 102 printf("\n Bdsh built-in commands:\n"); 132 103 printf(" ------------------------------------------------------------\n"); 133 104 … … 154 125 printf("\n Try %s %s for more information on how `%s' works.\n\n", 155 126 cmdname, cmdname, cmdname); 127 } 128 129 /** Display survival tips. ('help' without arguments) */ 130 static void help_survival(void) 131 { 132 printf("Don't panic!\n\n"); 133 134 printf("This is Bdsh, the Brain dead shell, currently " 135 "the primary user interface to HelenOS. Bdsh allows you to enter " 136 "commands and supports history (Up, Down arrow keys), " 137 "line editing (Left Arrow, Right Arrow, Home, End, Backspace), " 138 "selection (Shift + movement keys), copy and paste (Ctrl-C, " 139 "Ctrl-V), similar to common desktop environments.\n\n"); 140 141 printf("The most basic filesystem commands are Bdsh builtins. Type " 142 "'help commands' [Enter] to see the list of Bdsh builtin commands. " 143 "Other commands are external executables located in the /app and " 144 "/srv directories. Type 'ls /app' [Enter] and 'ls /srv' [Enter] " 145 "to see their list. You can execute an external command simply " 146 "by entering its name (e.g. type 'tetris' [Enter]).\n\n"); 147 148 printf("HelenOS has virtual consoles (VCs). You can switch between " 149 "these using the F1-F11 keys.\n\n"); 150 151 printf("This is but a small glimpse of what you can do with HelenOS. " 152 "To learn more please point your browser to the HelenOS User's " 153 "Guide: http://trac.helenos.org/trac.fcgi/wiki/UsersGuide\n\n"); 154 } 155 156 int cmd_help(char *argv[]) 157 { 158 int rc = 0; 159 int argc; 160 int level = HELP_SHORT; 161 162 argc = cli_count_args(argv); 163 164 if (argc > 3) { 165 printf("\nToo many arguments to `%s', try:\n", cmdname); 166 help_cmd_help(HELP_SHORT); 167 return CMD_FAILURE; 168 } 169 170 if (argc == 3) { 171 if (!str_cmp("extended", argv[2])) 172 level = HELP_LONG; 173 else 174 level = HELP_SHORT; 175 } 176 177 if (argc > 1) { 178 rc = is_mod_or_builtin(argv[1]); 179 switch (rc) { 180 case HELP_IS_RUBBISH: 181 printf("Invalid topic %s\n", argv[1]); 182 return CMD_FAILURE; 183 case HELP_IS_COMMANDS: 184 help_commands(); 185 return CMD_SUCCESS; 186 case HELP_IS_MODULE: 187 help_module(mod_switch, level); 188 return CMD_SUCCESS; 189 case HELP_IS_BUILTIN: 190 help_builtin(mod_switch, level); 191 return CMD_SUCCESS; 192 } 193 } 194 195 help_survival(); 156 196 157 197 return CMD_SUCCESS; -
uspace/app/bdsh/scli.c
r9e2e715 ra9db9b8 89 89 exit(EXIT_FAILURE); 90 90 91 printf("Welcome to %s - %s\nType `help' at any time for usage information.\n",92 progname, PACKAGE_STRING);93 94 91 while (!cli_quit) { 95 92 get_input(&usr); -
uspace/app/getterm/Makefile
r9e2e715 ra9db9b8 34 34 SOURCES = \ 35 35 getterm.c \ 36 version.c 36 version.c \ 37 welcome.c 37 38 38 39 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/getterm/getterm.c
r9e2e715 ra9db9b8 43 43 #include <errno.h> 44 44 #include "version.h" 45 #include "welcome.h" 45 46 46 47 #define APP_NAME "getterm" … … 48 49 static void usage(void) 49 50 { 50 printf("Usage: %s <terminal> <path>\n", APP_NAME);51 printf("Usage: %s <terminal> [-w] <command> [<arguments...>]\n", APP_NAME); 51 52 } 52 53 … … 73 74 } 74 75 75 static task_id_t spawn(const char *fname)76 {77 task_id_t id;78 int rc;79 80 rc = task_spawnl(&id, fname, fname, NULL);81 if (rc != EOK) {82 printf("%s: Error spawning %s (%s)\n", APP_NAME, fname,83 str_error(rc));84 return 0;85 }86 87 return id;88 }89 90 76 int main(int argc, char *argv[]) 91 77 { 92 if (argc < 3) { 78 int rc; 79 task_exit_t texit; 80 int retval; 81 task_id_t id; 82 char *fname, *term; 83 char **cmd_args; 84 bool print_wmsg; 85 86 ++argv; --argc; 87 if (argc < 1) { 93 88 usage(); 94 89 return -1; 95 90 } 91 92 if (str_cmp(*argv, "-w") == 0) { 93 print_wmsg = true; 94 ++argv; --argc; 95 } else { 96 print_wmsg = false; 97 } 98 99 if (argc < 2) { 100 usage(); 101 return -1; 102 } 103 104 term = *argv++; 105 fname = *argv; 106 cmd_args = argv; 96 107 97 reopen(&stdin, 0, argv[1], O_RDONLY, "r");98 reopen(&stdout, 1, argv[1], O_WRONLY, "w");99 reopen(&stderr, 2, argv[1], O_WRONLY, "w");108 reopen(&stdin, 0, term, O_RDONLY, "r"); 109 reopen(&stdout, 1, term, O_WRONLY, "w"); 110 reopen(&stderr, 2, term, O_WRONLY, "w"); 100 111 101 112 /* … … 114 125 return -4; 115 126 116 version_print( argv[1]);117 task_id_t id = spawn(argv[2]);118 119 if (id != 0) { 120 task_exit_t texit;121 int retval;122 task_wait(id, &texit, &retval);123 124 return 0;127 version_print(term); 128 if (print_wmsg) 129 welcome_msg_print(); 130 131 rc = task_spawnv(&id, fname, (const char * const *) cmd_args); 132 if (rc != EOK) { 133 printf("%s: Error spawning %s (%s)\n", APP_NAME, fname, 134 str_error(rc)); 135 return -5; 125 136 } 126 127 return -5; 137 138 rc = task_wait(id, &texit, &retval); 139 if (rc != EOK) { 140 printf("%s: Error waiting for %s (%s)\n", APP_NAME, fname, 141 str_error(rc)); 142 return -6; 143 } 144 145 return 0; 128 146 } 129 147 -
uspace/app/getterm/version.c
r9e2e715 ra9db9b8 61 61 printf("HelenOS release %s (%s)%s%s\n", release, name, revision, timestamp); 62 62 printf("Running on %s (%s)\n", arch, term); 63 printf("Copyright (c) 2001-20 09HelenOS project\n\n");63 printf("Copyright (c) 2001-2010 HelenOS project\n\n"); 64 64 } 65 65 -
uspace/app/init/init.c
r9e2e715 ra9db9b8 200 200 } 201 201 202 static void getterm(const char *dev, const char *app )202 static void getterm(const char *dev, const char *app, bool wmsg) 203 203 { 204 204 char term[DEVMAP_NAME_MAXLEN]; … … 218 218 } 219 219 220 rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, term, app, NULL); 221 if (rc != EOK) { 222 printf("%s: Error spawning %s %s %s (%s)\n", NAME, 223 APP_GETTERM, term, app, str_error(rc)); 220 if (wmsg) { 221 rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, "-w", term, 222 app, NULL); 223 if (rc != EOK) { 224 printf("%s: Error spawning %s -w %s %s (%s)\n", NAME, 225 APP_GETTERM, term, app, str_error(rc)); 226 } 227 } else { 228 rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, term, app, 229 NULL); 230 if (rc != EOK) { 231 printf("%s: Error spawning %s %s %s (%s)\n", NAME, 232 APP_GETTERM, term, app, str_error(rc)); 233 } 224 234 } 225 235 } … … 295 305 #endif 296 306 297 getterm("term/vc0", "/app/bdsh" );298 getterm("term/vc1", "/app/bdsh" );299 getterm("term/vc2", "/app/bdsh" );300 getterm("term/vc3", "/app/bdsh" );301 getterm("term/vc4", "/app/bdsh" );302 getterm("term/vc5", "/app/bdsh" );303 getterm("term/vc6", "/app/klog" );307 getterm("term/vc0", "/app/bdsh", true); 308 getterm("term/vc1", "/app/bdsh", false); 309 getterm("term/vc2", "/app/bdsh", false); 310 getterm("term/vc3", "/app/bdsh", false); 311 getterm("term/vc4", "/app/bdsh", false); 312 getterm("term/vc5", "/app/bdsh", false); 313 getterm("term/vc6", "/app/klog", false); 304 314 305 315 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.