Changeset 371bd7d in mainline for uspace/app
- Timestamp:
- 2010-03-27T09:22:17Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 36a75a2
- Parents:
- cd82bb1 (diff), eaf22d4 (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:
-
- 19 added
- 7 deleted
- 73 edited
- 8 moved
-
bdsh/Makefile (modified) (1 diff)
-
bdsh/Makefile.build (deleted)
-
bdsh/cmds/builtin_cmds.c (modified) (1 diff)
-
bdsh/cmds/builtins/builtins.h (modified) (1 diff)
-
bdsh/cmds/builtins/cd/cd.c (modified) (2 diffs)
-
bdsh/cmds/builtins/cd/cd_def.h (modified) (1 diff)
-
bdsh/cmds/builtins/exit/exit_def.h (modified) (1 diff)
-
bdsh/cmds/cmds.h (modified) (4 diffs)
-
bdsh/cmds/mod_cmds.c (modified) (1 diff)
-
bdsh/cmds/modules/bdd/bdd.c (modified) (2 diffs)
-
bdsh/cmds/modules/cat/cat.c (modified) (3 diffs)
-
bdsh/cmds/modules/cp/cp.c (modified) (2 diffs)
-
bdsh/cmds/modules/help/help.c (modified) (2 diffs)
-
bdsh/cmds/modules/kcon/kcon.c (modified) (1 diff)
-
bdsh/cmds/modules/ls/ls.c (modified) (3 diffs)
-
bdsh/cmds/modules/mkdir/mkdir.c (modified) (2 diffs)
-
bdsh/cmds/modules/mkfile/entry.h (added)
-
bdsh/cmds/modules/mkfile/mkfile.c (added)
-
bdsh/cmds/modules/mkfile/mkfile.h (added)
-
bdsh/cmds/modules/mkfile/mkfile_def.h (added)
-
bdsh/cmds/modules/module_aliases.h (modified) (1 diff)
-
bdsh/cmds/modules/modules.h (modified) (4 diffs)
-
bdsh/cmds/modules/mount/mount.c (modified) (1 diff)
-
bdsh/cmds/modules/pwd/pwd.c (modified) (1 diff)
-
bdsh/cmds/modules/rm/rm.c (modified) (2 diffs)
-
bdsh/cmds/modules/sleep/sleep.c (modified) (1 diff)
-
bdsh/cmds/modules/touch/touch.c (modified) (2 diffs)
-
bdsh/cmds/modules/unmount/entry.h (added)
-
bdsh/cmds/modules/unmount/unmount.c (added)
-
bdsh/cmds/modules/unmount/unmount.h (added)
-
bdsh/cmds/modules/unmount/unmount_def.h (added)
-
bdsh/errors.c (modified) (2 diffs)
-
bdsh/errstr.h (modified) (2 diffs)
-
bdsh/exec.c (modified) (2 diffs)
-
bdsh/exec.h (modified) (1 diff)
-
bdsh/input.c (modified) (3 diffs)
-
bdsh/scli.c (modified) (1 diff)
-
bdsh/scli.h (modified) (1 diff)
-
bdsh/util.c (modified) (1 diff)
-
edit/Makefile (modified) (1 diff)
-
edit/edit.c (modified) (14 diffs)
-
edit/sheet.c (modified) (1 diff)
-
getterm/Makefile (moved) (moved from uspace/app/redir/Makefile.common ) (2 diffs)
-
getterm/Makefile.build (moved) (moved from uspace/app/getvc/Makefile.build )
-
getterm/Makefile.common (moved) (moved from uspace/app/getvc/Makefile.common )
-
getterm/getterm.c (moved) (moved from uspace/app/getvc/getvc.c ) (3 diffs)
-
getterm/getterm.h (moved) (moved from uspace/app/getvc/getvc.h ) (2 diffs)
-
getterm/version.c (moved) (moved from uspace/app/getvc/version.c ) (2 diffs)
-
getterm/version.h (moved) (moved from uspace/app/getvc/version.h ) (2 diffs)
-
init/Makefile (modified) (1 diff)
-
init/init.c (modified) (12 diffs)
-
init/init.h (modified) (1 diff)
-
klog/Makefile (modified) (1 diff)
-
mkfat/Makefile (moved) (moved from uspace/app/init/Makefile.common ) (2 diffs)
-
mkfat/fat.h (added)
-
mkfat/mkfat.c (added)
-
redir/Makefile (modified) (1 diff)
-
redir/redir.c (modified) (2 diffs)
-
taskdump/Makefile (added)
-
taskdump/elf_core.c (added)
-
taskdump/include/elf.h (added)
-
taskdump/include/elf_core.h (added)
-
taskdump/include/symtab.h (added)
-
taskdump/symtab.c (added)
-
taskdump/taskdump.c (added)
-
tester/Makefile (modified) (1 diff)
-
tester/Makefile.build (deleted)
-
tester/Makefile.common (deleted)
-
tester/console/console1.c (modified) (2 diffs)
-
tester/fault/fault1.c (modified) (1 diff)
-
tester/fault/fault2.c (modified) (1 diff)
-
tester/fault/fault3.c (added)
-
tester/fault/fault3.def (added)
-
tester/ipc/connect.c (modified) (1 diff)
-
tester/ipc/ping_pong.c (modified) (1 diff)
-
tester/ipc/register.c (modified) (1 diff)
-
tester/loop/loop1.c (modified) (1 diff)
-
tester/mm/malloc1.c (modified) (3 diffs)
-
tester/print/print1.c (modified) (1 diff)
-
tester/print/print2.c (modified) (1 diff)
-
tester/print/print3.c (modified) (1 diff)
-
tester/print/print4.c (modified) (1 diff)
-
tester/stdio/stdio1.c (modified) (1 diff)
-
tester/stdio/stdio2.c (modified) (1 diff)
-
tester/tester.c (modified) (3 diffs)
-
tester/tester.h (modified) (1 diff)
-
tester/thread/thread1.c (modified) (1 diff)
-
tester/vfs/vfs1.c (modified) (5 diffs)
-
tetris/Makefile (modified) (1 diff)
-
tetris/Makefile.build (deleted)
-
tetris/Makefile.common (deleted)
-
tetris/input.c (modified) (1 diff)
-
tetris/scores.c (modified) (1 diff)
-
tetris/scores.h (modified) (1 diff)
-
tetris/screen.c (modified) (3 diffs)
-
tetris/tetris.c (modified) (1 diff)
-
tetris/tetris.h (modified) (1 diff)
-
trace/Makefile (modified) (1 diff)
-
trace/Makefile.build (deleted)
-
trace/Makefile.common (deleted)
-
trace/errors.h (modified) (1 diff)
-
trace/ipc_desc.h (modified) (1 diff)
-
trace/ipcp.c (modified) (4 diffs)
-
trace/proto.c (modified) (3 diffs)
-
trace/proto.h (modified) (3 diffs)
-
trace/syscalls.h (modified) (1 diff)
-
trace/trace.c (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/Makefile
rcd82bb1 r371bd7d 28 28 # 29 29 30 include Makefile.common 30 USPACE_PREFIX = ../.. 31 LIBS = $(LIBBLOCK_PREFIX)/libblock.a 32 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I. -Icmds/ -Icmds/builtins -Icmds/modules 33 BINARY = bdsh 31 34 32 .PHONY: all clean 35 SOURCES = \ 36 cmds/modules/help/help.c \ 37 cmds/modules/mkdir/mkdir.c \ 38 cmds/modules/mkfile/mkfile.c \ 39 cmds/modules/rm/rm.c \ 40 cmds/modules/bdd/bdd.c \ 41 cmds/modules/cat/cat.c \ 42 cmds/modules/touch/touch.c \ 43 cmds/modules/ls/ls.c \ 44 cmds/modules/pwd/pwd.c \ 45 cmds/modules/sleep/sleep.c \ 46 cmds/modules/cp/cp.c \ 47 cmds/modules/mv/mv.c \ 48 cmds/modules/mount/mount.c \ 49 cmds/modules/unmount/unmount.c \ 50 cmds/modules/kcon/kcon.c \ 51 cmds/builtins/exit/exit.c \ 52 cmds/builtins/cd/cd.c \ 53 cmds/mod_cmds.c \ 54 cmds/builtin_cmds.c \ 55 errors.c \ 56 input.c \ 57 util.c \ 58 exec.c \ 59 scli.c 33 60 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 37 38 clean: 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; 61 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/bdsh/cmds/builtin_cmds.c
rcd82bb1 r371bd7d 34 34 #include <stdio.h> 35 35 #include <stdlib.h> 36 #include <str ing.h>36 #include <str.h> 37 37 #include "errors.h" 38 38 #include "cmds.h" -
uspace/app/bdsh/cmds/builtins/builtins.h
rcd82bb1 r371bd7d 10 10 #include "cd/cd_def.h" 11 11 #include "exit/exit_def.h" 12 {NULL, NULL, NULL, NULL }12 {NULL, NULL, NULL, NULL, NULL} 13 13 }; 14 14 -
uspace/app/bdsh/cmds/builtins/cd/cd.c
rcd82bb1 r371bd7d 32 32 #include <stdlib.h> 33 33 #include <unistd.h> 34 #include <str ing.h>34 #include <str.h> 35 35 #include <errno.h> 36 36 … … 41 41 #include "cd.h" 42 42 43 static c har *cmdname = "cd";43 static const char *cmdname = "cd"; 44 44 45 45 void help_cmd_cd(unsigned int level) -
uspace/app/bdsh/cmds/builtins/cd/cd_def.h
rcd82bb1 r371bd7d 4 4 &cmd_cd, 5 5 &help_cmd_cd, 6 0 6 7 }, -
uspace/app/bdsh/cmds/builtins/exit/exit_def.h
rcd82bb1 r371bd7d 4 4 &cmd_exit, 5 5 &help_cmd_exit, 6 0 6 7 }, -
uspace/app/bdsh/cmds/cmds.h
rcd82bb1 r371bd7d 33 33 /* Module structure */ 34 34 typedef struct { 35 c har *name;/* Name of the command */36 c har *desc;/* Description of the command */35 const char *name; /* Name of the command */ 36 const char *desc; /* Description of the command */ 37 37 mod_entry_t entry; /* Command (exec) entry function */ 38 38 mod_help_t help; /* Command (help) entry function */ … … 41 41 /* Builtin structure, same as modules except different types of entry points */ 42 42 typedef struct { 43 c har *name;44 c har *desc;43 const char *name; 44 const char *desc; 45 45 builtin_entry_t entry; 46 46 builtin_help_t help; … … 57 57 extern int is_module(const char *); 58 58 extern int is_module_alias(const char *); 59 extern char * alias_for_module(const char *);59 extern char *alias_for_module(const char *); 60 60 extern int help_module(int, unsigned int); 61 61 extern int run_module(int, char *[]); … … 65 65 extern int is_builtin(const char *); 66 66 extern int is_builtin_alias(const char *); 67 extern char * alias_for_builtin(const char *);67 extern char *alias_for_builtin(const char *); 68 68 extern int help_builtin(int, unsigned int); 69 69 extern int run_builtin(int, char *[], cliuser_t *); -
uspace/app/bdsh/cmds/mod_cmds.c
rcd82bb1 r371bd7d 47 47 #include <stdio.h> 48 48 #include <stdlib.h> 49 #include <str ing.h>49 #include <str.h> 50 50 #include "errors.h" 51 51 #include "cmds.h" -
uspace/app/bdsh/cmds/modules/bdd/bdd.c
rcd82bb1 r371bd7d 29 29 #include <stdio.h> 30 30 #include <stdlib.h> 31 #include <str ing.h>31 #include <str.h> 32 32 #include "config.h" 33 33 #include "util.h" … … 73 73 size_t block_size; 74 74 int rc; 75 bn_t ba;75 aoff64_t ba; 76 76 uint8_t b; 77 77 -
uspace/app/bdsh/cmds/modules/cat/cat.c
rcd82bb1 r371bd7d 33 33 #include <unistd.h> 34 34 #include <getopt.h> 35 #include <str ing.h>35 #include <str.h> 36 36 #include <fcntl.h> 37 37 … … 43 43 #include "cmds.h" 44 44 45 static c har *cmdname = "cat";45 static const char *cmdname = "cat"; 46 46 #define CAT_VERSION "0.0.1" 47 47 #define CAT_DEFAULT_BUFLEN 1024 48 48 49 static c har *cat_oops = "That option is not yet supported\n";49 static const char *cat_oops = "That option is not yet supported\n"; 50 50 51 51 static struct option const long_options[] = { … … 85 85 { 86 86 int fd, bytes = 0, count = 0, reads = 0; 87 off _t total = 0;87 off64_t total = 0; 88 88 char *buff = NULL; 89 89 -
uspace/app/bdsh/cmds/modules/cp/cp.c
rcd82bb1 r371bd7d 33 33 #include <unistd.h> 34 34 #include <getopt.h> 35 #include <str ing.h>35 #include <str.h> 36 36 #include <fcntl.h> 37 37 #include "config.h" … … 74 74 { 75 75 int fd1, fd2, bytes = 0; 76 off _t total = 0;76 off64_t total = 0; 77 77 int64_t copied = 0; 78 78 char *buff = NULL; -
uspace/app/bdsh/cmds/modules/help/help.c
rcd82bb1 r371bd7d 31 31 #include <stdio.h> 32 32 #include <stdlib.h> 33 #include <str ing.h>33 #include <str.h> 34 34 35 35 #include "config.h" … … 42 42 #include "util.h" 43 43 44 static c har *cmdname = "help";44 static const char *cmdname = "help"; 45 45 extern const char *progname; 46 46 -
uspace/app/bdsh/cmds/modules/kcon/kcon.c
rcd82bb1 r371bd7d 40 40 #include "cmds.h" 41 41 42 static c har *cmdname = "kcon";42 static const char *cmdname = "kcon"; 43 43 44 44 /* Dispays help for kcon in various levels */ -
uspace/app/bdsh/cmds/modules/ls/ls.c
rcd82bb1 r371bd7d 40 40 #include <sys/types.h> 41 41 #include <sys/stat.h> 42 #include <str ing.h>42 #include <str.h> 43 43 44 44 #include "errors.h" … … 49 49 #include "cmds.h" 50 50 51 static c har *cmdname = "ls";51 static const char *cmdname = "ls"; 52 52 53 53 static void ls_scan_dir(const char *d, DIR *dirp) … … 100 100 if (s.is_file) 101 101 printf("%-40s\t%llu\n", name, (long long) s.size); 102 else if (s.is_directory) 103 printf("%-40s\t<dir>\n", name); 102 104 else 103 105 printf("%-40s\n", name); -
uspace/app/bdsh/cmds/modules/mkdir/mkdir.c
rcd82bb1 r371bd7d 38 38 #include <getopt.h> 39 39 #include <stdarg.h> 40 #include <str ing.h>40 #include <str.h> 41 41 42 42 #include "config.h" … … 49 49 #define MKDIR_VERSION "0.0.1" 50 50 51 static c har *cmdname = "mkdir";51 static const char *cmdname = "mkdir"; 52 52 53 53 static struct option const long_options[] = { -
uspace/app/bdsh/cmds/modules/module_aliases.h
rcd82bb1 r371bd7d 12 12 * the entry point being reached. */ 13 13 14 c har *mod_aliases[] = {14 const char *mod_aliases[] = { 15 15 "ren", "mv", 16 "umount", "unmount", 16 17 NULL, NULL 17 18 }; -
uspace/app/bdsh/cmds/modules/modules.h
rcd82bb1 r371bd7d 20 20 #include "help/entry.h" 21 21 #include "mkdir/entry.h" 22 #include "mkfile/entry.h" 22 23 #include "rm/entry.h" 23 24 #include "bdd/entry.h" … … 30 31 #include "mv/entry.h" 31 32 #include "mount/entry.h" 33 #include "unmount/entry.h" 32 34 #include "kcon/entry.h" 33 35 … … 39 41 #include "help/help_def.h" 40 42 #include "mkdir/mkdir_def.h" 43 #include "mkfile/mkfile_def.h" 41 44 #include "rm/rm_def.h" 42 45 #include "bdd/bdd_def.h" … … 49 52 #include "mv/mv_def.h" 50 53 #include "mount/mount_def.h" 54 #include "unmount/unmount_def.h" 51 55 #include "kcon/kcon_def.h" 52 56 -
uspace/app/bdsh/cmds/modules/mount/mount.c
rcd82bb1 r371bd7d 58 58 { 59 59 unsigned int argc; 60 c har *mopts = "";60 const char *mopts = ""; 61 61 int rc; 62 62 -
uspace/app/bdsh/cmds/modules/pwd/pwd.c
rcd82bb1 r371bd7d 39 39 #include "pwd.h" 40 40 41 static c har *cmdname = "pwd";41 static const char *cmdname = "pwd"; 42 42 43 43 void help_cmd_pwd(unsigned int level) -
uspace/app/bdsh/cmds/modules/rm/rm.c
rcd82bb1 r371bd7d 36 36 #include <getopt.h> 37 37 #include <mem.h> 38 #include <str ing.h>38 #include <str.h> 39 39 40 40 #include "config.h" … … 45 45 #include "cmds.h" 46 46 47 static c har *cmdname = "rm";47 static const char *cmdname = "rm"; 48 48 #define RM_VERSION "0.0.1" 49 49 -
uspace/app/bdsh/cmds/modules/sleep/sleep.c
rcd82bb1 r371bd7d 38 38 #include "cmds.h" 39 39 40 static c har *cmdname = "sleep";40 static const char *cmdname = "sleep"; 41 41 42 42 /* Dispays help for sleep in various levels */ -
uspace/app/bdsh/cmds/modules/touch/touch.c
rcd82bb1 r371bd7d 38 38 #include <dirent.h> 39 39 #include <sys/types.h> 40 #include <str ing.h>40 #include <str.h> 41 41 42 42 #include "config.h" … … 47 47 #include "cmds.h" 48 48 49 static c har *cmdname = "touch";49 static const char *cmdname = "touch"; 50 50 51 51 /* Dispays help for touch in various levels */ -
uspace/app/bdsh/errors.c
rcd82bb1 r371bd7d 30 30 31 31 #include <stdio.h> 32 #include <str ing.h>32 #include <str.h> 33 33 #include <stdlib.h> 34 34 #include <unistd.h> … … 47 47 /* Look up errno in cl_errors and return the corresponding string. 48 48 * Return NULL if not found */ 49 static c har *err2str(int err)49 static const char *err2str(int err) 50 50 { 51 51 -
uspace/app/bdsh/errstr.h
rcd82bb1 r371bd7d 4 4 /* Simple array to translate error codes to meaningful strings */ 5 5 6 static c har *cl_errors[] = {6 static const char *cl_errors[] = { 7 7 "Success", 8 8 "Failure", … … 18 18 }; 19 19 20 static c har *err2str(int);20 static const char *err2str(int); 21 21 22 22 #endif -
uspace/app/bdsh/exec.c
rcd82bb1 r371bd7d 38 38 #include <stdlib.h> 39 39 #include <unistd.h> 40 #include <str ing.h>40 #include <str.h> 41 41 #include <fcntl.h> 42 42 … … 120 120 free(found); 121 121 122 tid = task_spawn( (const char *)tmp,argv);122 tid = task_spawn(tmp, (const char **) argv); 123 123 free(tmp); 124 124 -
uspace/app/bdsh/exec.h
rcd82bb1 r371bd7d 5 5 6 6 extern unsigned int try_exec(char *, char **); 7 7 8 #endif -
uspace/app/bdsh/input.c
rcd82bb1 r371bd7d 32 32 #include <stdio.h> 33 33 #include <stdlib.h> 34 #include <str ing.h>34 #include <str.h> 35 35 #include <io/console.h> 36 36 #include <io/keycode.h> … … 508 508 { 509 509 int sa, sb; 510 wchar_t tmp_c;511 510 char *str; 512 511 … … 514 513 515 514 if (sb < ti->nc) { 516 tmp_c = ti->buffer[sb];515 wchar_t tmp_c = ti->buffer[sb]; 517 516 ti->buffer[sb] = '\0'; 518 } 519 520 str = wstr_to_astr(ti->buffer + sa); 521 522 if (sb < ti->nc) 517 str = wstr_to_astr(ti->buffer + sa); 523 518 ti->buffer[sb] = tmp_c; 524 519 } else 520 str = wstr_to_astr(ti->buffer + sa); 521 525 522 if (str == NULL) 526 523 goto error; -
uspace/app/bdsh/scli.c
rcd82bb1 r371bd7d 31 31 #include <stdio.h> 32 32 #include <stdlib.h> 33 #include <str ing.h>33 #include <str.h> 34 34 #include <unistd.h> 35 35 #include "config.h" -
uspace/app/bdsh/scli.h
rcd82bb1 r371bd7d 6 6 7 7 typedef struct { 8 c har *name;8 const char *name; 9 9 char *line; 10 10 char *cwd; -
uspace/app/bdsh/util.c
rcd82bb1 r371bd7d 29 29 30 30 #include <stdio.h> 31 #include <str ing.h>31 #include <str.h> 32 32 #include <stdarg.h> 33 33 #include <stdlib.h> -
uspace/app/edit/Makefile
rcd82bb1 r371bd7d 28 28 # 29 29 30 include Makefile.common 30 USPACE_PREFIX = ../.. 31 BINARY = edit 31 32 32 .PHONY: all clean 33 SOURCES = \ 34 edit.c \ 35 sheet.c 33 36 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 37 38 clean: 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; 37 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/edit/edit.c
rcd82bb1 r371bd7d 98 98 static bool done; 99 99 static pane_t pane; 100 static bool cursor_visible; 100 101 101 102 static int scr_rows, scr_columns; … … 108 109 /** Maximum filename length that can be entered. */ 109 110 #define INFNAME_MAX_LEN 128 111 112 static void cursor_show(void); 113 static void cursor_hide(void); 114 static void cursor_setvis(bool visible); 110 115 111 116 static void key_handle_unmod(console_event_t const *ev); … … 199 204 200 205 /* Initial display */ 206 cursor_visible = true; 207 208 cursor_hide(); 201 209 console_clear(con); 202 210 pane_text_display(); … … 205 213 status_display("File not found. Starting empty file."); 206 214 pane_caret_display(); 207 215 cursor_show(); 208 216 209 217 done = false; … … 230 238 /* Redraw as necessary. */ 231 239 240 cursor_hide(); 241 232 242 if (pane.rflags & REDRAW_TEXT) 233 243 pane_text_display(); … … 238 248 if (pane.rflags & REDRAW_CARET) 239 249 pane_caret_display(); 250 251 cursor_show(); 240 252 } 241 253 … … 243 255 244 256 return 0; 257 } 258 259 static void cursor_show(void) 260 { 261 cursor_setvis(true); 262 } 263 264 static void cursor_hide(void) 265 { 266 cursor_setvis(false); 267 } 268 269 static void cursor_setvis(bool visible) 270 { 271 if (cursor_visible != visible) { 272 console_cursor_visibility(con, visible); 273 cursor_visible = visible; 274 } 245 275 } 246 276 … … 445 475 static void file_save_as(void) 446 476 { 447 char *old_fname, *fname; 448 int rc; 449 450 old_fname = (doc.file_name != NULL) ? doc.file_name : ""; 477 const char *old_fname = (doc.file_name != NULL) ? doc.file_name : ""; 478 char *fname; 479 451 480 fname = filename_prompt("Save As", old_fname); 452 481 if (fname == NULL) { … … 455 484 } 456 485 457 rc = file_save(fname);486 int rc = file_save(fname); 458 487 if (rc != EOK) 459 488 return; … … 688 717 wchar_t c; 689 718 size_t pos, size; 690 unsigneds_column;719 int s_column; 691 720 coord_t csel_start, csel_end, ctmp; 692 721 … … 736 765 s_column = pane.sh_column; 737 766 while (pos < size) { 738 if ( csel_start.row == rbc.row && csel_start.column == s_column) {767 if ((csel_start.row == rbc.row) && (csel_start.column == s_column)) { 739 768 fflush(stdout); 740 769 console_set_color(con, COLOR_BLACK, COLOR_RED, 0); … … 742 771 } 743 772 744 if ( csel_end.row == rbc.row && csel_end.column == s_column) {773 if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) { 745 774 fflush(stdout); 746 775 console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0); … … 762 791 } 763 792 764 if ( csel_end.row == rbc.row && csel_end.column == s_column) {793 if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) { 765 794 fflush(stdout); 766 795 console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0); … … 789 818 spt_t caret_pt; 790 819 coord_t coord; 791 char *fname;792 int n;793 820 794 821 tag_get_pt(&pane.caret_pos, &caret_pt); 795 822 spt_get_coord(&caret_pt, &coord); 796 823 797 fname = (doc.file_name != NULL) ? doc.file_name : "<unnamed>";824 const char *fname = (doc.file_name != NULL) ? doc.file_name : "<unnamed>"; 798 825 799 826 console_goto(con, 0, scr_rows - 1); 800 827 console_set_color(con, COLOR_WHITE, COLOR_BLACK, 0); 801 n = printf(" %d, %d: File '%s'. Ctrl-Q Quit Ctrl-S Save "828 int n = printf(" %d, %d: File '%s'. Ctrl-Q Quit Ctrl-S Save " 802 829 "Ctrl-E Save As", coord.row, coord.column, fname); 803 830 printf("%*s", scr_columns - 1 - n, ""); -
uspace/app/edit/sheet.c
rcd82bb1 r371bd7d 50 50 51 51 #include <stdlib.h> 52 #include <str ing.h>52 #include <str.h> 53 53 #include <errno.h> 54 54 #include <adt/list.h> -
uspace/app/getterm/Makefile
rcd82bb1 r371bd7d 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 30 USPACE_PREFIX = ../.. 31 DEFS = -DRELEASE=$(RELEASE) "-DNAME=$(NAME)" 32 BINARY = getterm 29 33 30 ## Common names 31 # 34 SOURCES = \ 35 getterm.c \ 36 version.c 32 37 33 LIBC_PREFIX = ../../lib/libc 34 SOFTINT_PREFIX = ../../lib/softint 35 LIBS = $(LIBC_PREFIX)/libc.a 36 37 DEPEND = Makefile.depend 38 DEPEND_PREV = $(DEPEND).prev 39 OUTPUT = redir 38 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/getterm/getterm.c
rcd82bb1 r371bd7d 27 27 */ 28 28 29 /** @addtogroup get vc GetVC29 /** @addtogroup getterm GetTerm 30 30 * @brief Console initialization task. 31 31 * @{ … … 44 44 static void usage(void) 45 45 { 46 printf("Usage: get vc <device> <path>\n");46 printf("Usage: getterm <terminal> <path>\n"); 47 47 } 48 48 … … 69 69 } 70 70 71 static task_id_t spawn(c har *fname)71 static task_id_t spawn(const char *fname) 72 72 { 73 c har *args[2];73 const char *args[2]; 74 74 75 75 args[0] = fname; -
uspace/app/getterm/getterm.h
rcd82bb1 r371bd7d 27 27 */ 28 28 29 /** @addtogroup get vc29 /** @addtogroup getterm 30 30 * @{ 31 31 */ … … 34 34 */ 35 35 36 #ifndef GET VC_H__37 #define GET VC_H__36 #ifndef GETTERM_H__ 37 #define GETTERM_H__ 38 38 39 39 #endif -
uspace/app/getterm/version.c
rcd82bb1 r371bd7d 27 27 */ 28 28 29 /** @addtogroup get vc29 /** @addtogroup getterm 30 30 * @{ 31 31 */ … … 37 37 #include <stdio.h> 38 38 #include <macros.h> 39 #include "get vc.h"39 #include "getterm.h" 40 40 #include "version.h" 41 41 42 static c har *release = STRING(RELEASE);43 static c har *name = STRING(NAME);44 static c har *arch = STRING(UARCH);42 static const char *release = STRING(RELEASE); 43 static const char *name = STRING(NAME); 44 static const char *arch = STRING(UARCH); 45 45 46 46 #ifdef REVISION 47 static c har *revision = ", revision " STRING(REVISION);47 static const char *revision = ", revision " STRING(REVISION); 48 48 #else 49 static c har *revision = "";49 static const char *revision = ""; 50 50 #endif 51 51 52 52 #ifdef TIMESTAMP 53 static c har *timestamp = "\nBuilt on " STRING(TIMESTAMP);53 static const char *timestamp = "\nBuilt on " STRING(TIMESTAMP); 54 54 #else 55 static c har *timestamp = "";55 static const char *timestamp = ""; 56 56 #endif 57 57 58 58 /** Print version information. */ 59 void version_print(const char * vc)59 void version_print(const char *term) 60 60 { 61 61 printf("HelenOS release %s (%s)%s%s\n", release, name, revision, timestamp); 62 printf("Running on %s (%s)\n", arch, vc);62 printf("Running on %s (%s)\n", arch, term); 63 63 printf("Copyright (c) 2001-2009 HelenOS project\n\n"); 64 64 } -
uspace/app/getterm/version.h
rcd82bb1 r371bd7d 27 27 */ 28 28 29 /** @addtogroup get vc29 /** @addtogroup getterm 30 30 * @{ 31 31 */ … … 37 37 #define VERSION_H__ 38 38 39 extern void version_print(const char * vc);39 extern void version_print(const char *term); 40 40 41 41 #endif -
uspace/app/init/Makefile
rcd82bb1 r371bd7d 28 28 # 29 29 30 include Makefile.common 30 USPACE_PREFIX = ../.. 31 BINARY = init 31 32 32 .PHONY: all clean 33 SOURCES = \ 34 init.c 33 35 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 37 38 clean: 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; 36 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/init/init.c
rcd82bb1 r371bd7d 46 46 #include <malloc.h> 47 47 #include <macros.h> 48 #include <str ing.h>48 #include <str.h> 49 49 #include <devmap.h> 50 50 #include "init.h" 51 51 52 #define DEVFS_MOUNT_POINT "/dev" 53 54 #define SRV_CONSOLE "/srv/console" 55 #define APP_GETTERM "/app/getterm" 56 52 57 static void info_print(void) 53 58 { … … 57 62 static bool mount_root(const char *fstype) 58 63 { 59 c har *opts = "";60 const char *root_dev = " initrd";64 const char *opts = ""; 65 const char *root_dev = "bd/initrd"; 61 66 62 67 if (str_cmp(fstype, "tmpfs") == 0) … … 89 94 static bool mount_devfs(void) 90 95 { 91 char null[MAX_DEVICE_NAME]; 92 int null_id = devmap_null_create(); 93 94 if (null_id == -1) { 95 printf(NAME ": Unable to create null device\n"); 96 return false; 97 } 98 99 snprintf(null, MAX_DEVICE_NAME, "null%d", null_id); 100 int rc = mount("devfs", "/dev", null, "", IPC_FLAG_BLOCKING); 96 int rc = mount("devfs", DEVFS_MOUNT_POINT, "", "", IPC_FLAG_BLOCKING); 101 97 102 98 switch (rc) { … … 106 102 case EBUSY: 107 103 printf(NAME ": Device filesystem already mounted\n"); 108 devmap_null_destroy(null_id);109 104 return false; 110 105 case ELIMIT: 111 106 printf(NAME ": Unable to mount device filesystem\n"); 112 devmap_null_destroy(null_id);113 107 return false; 114 108 case ENOENT: 115 109 printf(NAME ": Unknown filesystem type (devfs)\n"); 116 devmap_null_destroy(null_id);117 110 return false; 118 111 default: 119 112 printf(NAME ": Error mounting device filesystem (%d)\n", rc); 120 devmap_null_destroy(null_id);121 113 return false; 122 114 } … … 125 117 } 126 118 127 static void spawn(c har *fname)128 { 129 c har *argv[2];119 static void spawn(const char *fname) 120 { 121 const char *argv[2]; 130 122 struct stat s; 131 123 … … 142 134 } 143 135 144 static void srv_start(c har *fname)145 { 146 c har *argv[2];136 static void srv_start(const char *fname) 137 { 138 const char *argv[2]; 147 139 task_id_t id; 148 140 task_exit_t texit; … … 170 162 } 171 163 172 if ( texit != TASK_EXIT_NORMAL || retval != 0) {164 if ((texit != TASK_EXIT_NORMAL) || (retval != 0)) { 173 165 printf(NAME ": Server %s failed to start (returned %d)\n", 174 166 fname, retval); … … 176 168 } 177 169 178 static void getvc(char *dev, char *app)179 { 180 c har *argv[4];181 char vc[MAX_DEVICE_NAME];170 static void console(const char *dev) 171 { 172 const char *argv[3]; 173 char hid_in[DEVMAP_NAME_MAXLEN]; 182 174 int rc; 183 175 184 snprintf(vc, MAX_DEVICE_NAME, "/dev/%s", dev); 185 186 printf(NAME ": Spawning getvc on %s\n", vc); 187 176 snprintf(hid_in, DEVMAP_NAME_MAXLEN, "%s/%s", DEVFS_MOUNT_POINT, dev); 177 178 printf(NAME ": Spawning %s with %s\n", SRV_CONSOLE, hid_in); 179 180 /* Wait for the input device to be ready */ 188 181 dev_handle_t handle; 189 182 rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING); 190 183 191 184 if (rc == EOK) { 192 argv[0] = "/app/getvc"; 193 argv[1] = vc; 185 argv[0] = SRV_CONSOLE; 186 argv[1] = hid_in; 187 argv[2] = NULL; 188 189 if (!task_spawn(SRV_CONSOLE, argv)) 190 printf(NAME ": Error spawning %s with %s\n", SRV_CONSOLE, hid_in); 191 } else 192 printf(NAME ": Error waiting on %s\n", hid_in); 193 } 194 195 static void getterm(const char *dev, const char *app) 196 { 197 const char *argv[4]; 198 char term[DEVMAP_NAME_MAXLEN]; 199 int rc; 200 201 snprintf(term, DEVMAP_NAME_MAXLEN, "%s/%s", DEVFS_MOUNT_POINT, dev); 202 203 printf(NAME ": Spawning %s with %s %s\n", APP_GETTERM, term, app); 204 205 /* Wait for the terminal device to be ready */ 206 dev_handle_t handle; 207 rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING); 208 209 if (rc == EOK) { 210 argv[0] = APP_GETTERM; 211 argv[1] = term; 194 212 argv[2] = app; 195 213 argv[3] = NULL; 196 214 197 if (!task_spawn( "/app/getvc", argv))198 printf(NAME ": Error spawning getvc on %s\n", vc);199 } else {200 printf(NAME ": Error waiting on %s\n", vc);201 }202 } 203 204 static void mount_ data(void)215 if (!task_spawn(APP_GETTERM, argv)) 216 printf(NAME ": Error spawning %s with %s %s\n", APP_GETTERM, 217 term, app); 218 } else 219 printf(NAME ": Error waiting on %s\n", term); 220 } 221 222 static void mount_scratch(void) 205 223 { 206 224 int rc; 207 225 208 printf("Trying to mount disk0 on /data... ");226 printf("Trying to mount null/0 on /scratch... "); 209 227 fflush(stdout); 210 228 211 rc = mount(" fat", "/data", "disk0", "wtcache", 0);229 rc = mount("tmpfs", "/scratch", "null/0", "", 0); 212 230 if (rc == EOK) 213 231 printf("OK\n"); … … 216 234 } 217 235 236 static void mount_data(void) 237 { 238 int rc; 239 240 printf("Trying to mount bd/disk0 on /data... "); 241 fflush(stdout); 242 243 rc = mount("fat", "/data", "bd/disk0", "wtcache", 0); 244 if (rc == EOK) 245 printf("OK\n"); 246 else 247 printf("Failed\n"); 248 } 249 218 250 int main(int argc, char *argv[]) 219 251 { … … 224 256 return -1; 225 257 } 258 259 /* Make sure tmpfs is running. */ 260 if (str_cmp(STRING(RDFMT), "tmpfs") != 0) { 261 spawn("/srv/tmpfs"); 262 } 226 263 227 264 spawn("/srv/devfs"); 265 spawn("/srv/taskmon"); 228 266 229 267 if (!mount_devfs()) { … … 231 269 return -2; 232 270 } 233 271 272 mount_scratch(); 273 274 spawn("/srv/fhc"); 275 spawn("/srv/obio"); 276 srv_start("/srv/cuda_adb"); 277 srv_start("/srv/i8042"); 278 srv_start("/srv/adb_ms"); 279 srv_start("/srv/char_ms"); 280 234 281 spawn("/srv/fb"); 235 282 spawn("/srv/kbd"); 236 spawn("/srv/console");237 spawn("/srv/fhc");238 spawn("/srv/ obio");283 console("hid_in/kbd"); 284 285 spawn("/srv/clip"); 239 286 240 287 /* … … 255 302 #endif 256 303 257 get vc("vc0", "/app/bdsh");258 get vc("vc1", "/app/bdsh");259 get vc("vc2", "/app/bdsh");260 get vc("vc3", "/app/bdsh");261 get vc("vc4", "/app/bdsh");262 get vc("vc5", "/app/bdsh");263 get vc("vc6", "/app/klog");264 304 getterm("term/vc0", "/app/bdsh"); 305 getterm("term/vc1", "/app/bdsh"); 306 getterm("term/vc2", "/app/bdsh"); 307 getterm("term/vc3", "/app/bdsh"); 308 getterm("term/vc4", "/app/bdsh"); 309 getterm("term/vc5", "/app/bdsh"); 310 getterm("term/vc6", "/app/klog"); 311 265 312 return 0; 266 313 } -
uspace/app/init/init.h
rcd82bb1 r371bd7d 39 39 #define NAME "init" 40 40 41 #define MAX_DEVICE_NAME 3242 43 41 #endif 44 42 -
uspace/app/klog/Makefile
rcd82bb1 r371bd7d 28 28 # 29 29 30 include Makefile.common 30 USPACE_PREFIX = ../.. 31 BINARY = klog 31 32 32 .PHONY: all clean 33 SOURCES = \ 34 klog.c 33 35 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 37 38 clean: 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; 36 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/mkfat/Makefile
rcd82bb1 r371bd7d 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 30 USPACE_PREFIX = ../.. 31 LIBS = $(LIBBLOCK_PREFIX)/libblock.a 32 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) 33 BINARY = mkfat 29 34 30 ## Common names 31 # 35 SOURCES = \ 36 mkfat.c 32 37 33 LIBC_PREFIX = ../../lib/libc 34 SOFTINT_PREFIX = ../../lib/softint 35 LIBS = $(LIBC_PREFIX)/libc.a 36 37 DEPEND = Makefile.depend 38 DEPEND_PREV = $(DEPEND).prev 39 OUTPUT = init 38 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/redir/Makefile
rcd82bb1 r371bd7d 28 28 # 29 29 30 include Makefile.common 30 USPACE_PREFIX = ../.. 31 BINARY = redir 31 32 32 .PHONY: all clean 33 SOURCES = \ 34 redir.c 33 35 34 all: $(LIBC_PREFIX)/../../../version $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 37 38 clean: 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; 36 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/redir/redir.c
rcd82bb1 r371bd7d 39 39 #include <fcntl.h> 40 40 #include <unistd.h> 41 #include <str ing.h>41 #include <str.h> 42 42 #include <stdio.h> 43 43 #include <task.h> … … 72 72 static task_id_t spawn(int argc, char *argv[]) 73 73 { 74 c har **args = (char*) calloc(argc + 1, sizeof(char *));74 const char **args = (const char **) calloc(argc + 1, sizeof(char *)); 75 75 if (!args) { 76 76 printf("No memory available\n"); -
uspace/app/tester/Makefile
rcd82bb1 r371bd7d 28 28 # 29 29 30 include Makefile.common 30 USPACE_PREFIX = ../.. 31 BINARY = tester 31 32 32 .PHONY: all clean 33 SOURCES = \ 34 tester.c \ 35 thread/thread1.c \ 36 print/print1.c \ 37 print/print2.c \ 38 print/print3.c \ 39 print/print4.c \ 40 console/console1.c \ 41 stdio/stdio1.c \ 42 stdio/stdio2.c \ 43 fault/fault1.c \ 44 fault/fault2.c \ 45 fault/fault3.c \ 46 vfs/vfs1.c \ 47 ipc/ping_pong.c \ 48 ipc/register.c \ 49 ipc/connect.c \ 50 loop/loop1.c \ 51 mm/malloc1.c 33 52 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 37 38 clean: 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; 53 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/tester/console/console1.c
rcd82bb1 r371bd7d 36 36 #include "../tester.h" 37 37 38 const char *color_name[] = {38 static const char *color_name[] = { 39 39 [COLOR_BLACK] = "black", 40 40 [COLOR_BLUE] = "blue", … … 47 47 }; 48 48 49 c har *test_console1(void)49 const char *test_console1(void) 50 50 { 51 51 if (!test_quiet) { -
uspace/app/tester/fault/fault1.c
rcd82bb1 r371bd7d 30 30 #include "../tester.h" 31 31 32 c har *test_fault1(void)32 const char *test_fault1(void) 33 33 { 34 34 ((int *)(0))[1] = 0; -
uspace/app/tester/fault/fault2.c
rcd82bb1 r371bd7d 30 30 #include "../tester.h" 31 31 32 char *test_fault2(void) 32 typedef int __attribute__((may_alias)) aliasing_int; 33 34 const char *test_fault2(void) 33 35 { 34 36 volatile long long var; 35 37 volatile int var1; 36 38 37 var1 = *(( int *) (((char *) (&var)) + 1));39 var1 = *((aliasing_int *) (((char *) (&var)) + 1)); 38 40 39 41 return "Survived unaligned read"; -
uspace/app/tester/ipc/connect.c
rcd82bb1 r371bd7d 39 39 } 40 40 41 c har *test_connect(void)41 const char *test_connect(void) 42 42 { 43 43 TPRINTF("Connecting to %u...", IPC_TEST_SERVICE); -
uspace/app/tester/ipc/ping_pong.c
rcd82bb1 r371bd7d 38 38 #define COUNT_GRANULARITY 100 39 39 40 c har *test_ping_pong(void)40 const char *test_ping_pong(void) 41 41 { 42 42 TPRINTF("Pinging ns server for %d seconds...", DURATION_SECS); -
uspace/app/tester/ipc/register.c
rcd82bb1 r371bd7d 74 74 } 75 75 76 c har *test_register(void)76 const char *test_register(void) 77 77 { 78 78 async_set_client_connection(client_connection); -
uspace/app/tester/loop/loop1.c
rcd82bb1 r371bd7d 31 31 #include "../tester.h" 32 32 33 c har *test_loop1(void)33 const char *test_loop1(void) 34 34 { 35 35 TPRINTF("Looping..."); -
uspace/app/tester/mm/malloc1.c
rcd82bb1 r371bd7d 73 73 74 74 typedef struct { 75 c har *name;75 const char *name; 76 76 sp_term_cond_s cond; 77 77 sp_action_prob_s prob; … … 90 90 91 91 typedef struct { 92 c har *name;92 const char *name; 93 93 ph_alloc_size_s alloc; 94 94 subphase_s *subphases; … … 628 628 } 629 629 630 c har *test_malloc1(void)630 const char *test_malloc1(void) 631 631 { 632 632 init_mem(); -
uspace/app/tester/print/print1.c
rcd82bb1 r371bd7d 31 31 #include "../tester.h" 32 32 33 c har *test_print1(void)33 const char *test_print1(void) 34 34 { 35 35 TPRINTF("Testing printf(\"%%*.*s\", 5, 3, \"text\"):\n"); -
uspace/app/tester/print/print2.c
rcd82bb1 r371bd7d 31 31 #include "../tester.h" 32 32 33 c har *test_print2(void)33 const char *test_print2(void) 34 34 { 35 35 TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n"); -
uspace/app/tester/print/print3.c
rcd82bb1 r371bd7d 34 34 #define BUFFER_SIZE 32 35 35 36 c har *test_print3(void)36 const char *test_print3(void) 37 37 { 38 38 char buffer[BUFFER_SIZE]; -
uspace/app/tester/print/print4.c
rcd82bb1 r371bd7d 31 31 #include "../tester.h" 32 32 33 c har *test_print4(void)33 const char *test_print4(void) 34 34 { 35 35 TPRINTF("ASCII printable characters (32 - 127) using printf(\"%%c\") and printf(\"%%lc\"):\n"); -
uspace/app/tester/stdio/stdio1.c
rcd82bb1 r371bd7d 36 36 static char buf[BUF_SIZE + 1]; 37 37 38 c har *test_stdio1(void)38 const char *test_stdio1(void) 39 39 { 40 40 FILE *file; 41 c har *file_name = "/readme";41 const char *file_name = "/readme"; 42 42 43 43 TPRINTF("Open file \"%s\"...", file_name); -
uspace/app/tester/stdio/stdio2.c
rcd82bb1 r371bd7d 32 32 #include "../tester.h" 33 33 34 c har *test_stdio2(void)34 const char *test_stdio2(void) 35 35 { 36 36 FILE *file; 37 c har *file_name = "/test";37 const char *file_name = "/test"; 38 38 39 39 TPRINTF("Open file \"%s\" for writing...", file_name); -
uspace/app/tester/tester.c
rcd82bb1 r371bd7d 38 38 #include <unistd.h> 39 39 #include <stdio.h> 40 #include <str ing.h>40 #include <str.h> 41 41 #include "tester.h" 42 42 … … 56 56 #include "fault/fault1.def" 57 57 #include "fault/fault2.def" 58 #include "fault/fault3.def" 58 59 #include "vfs/vfs1.def" 59 60 #include "ipc/ping_pong.def" … … 68 69 { 69 70 /* Execute the test */ 70 c har *ret = test->entry();71 const char *ret = test->entry(); 71 72 72 73 if (ret == NULL) { -
uspace/app/tester/tester.h
rcd82bb1 r371bd7d 54 54 } 55 55 56 typedef c har *(*test_entry_t)(void);56 typedef const char *(*test_entry_t)(void); 57 57 58 58 typedef struct { 59 c har *name;60 c har *desc;59 const char *name; 60 const char *desc; 61 61 test_entry_t entry; 62 62 bool safe; 63 63 } test_t; 64 64 65 extern char *test_thread1(void); 66 extern char *test_print1(void); 67 extern char *test_print2(void); 68 extern char *test_print3(void); 69 extern char *test_print4(void); 70 extern char *test_console1(void); 71 extern char *test_stdio1(void); 72 extern char *test_stdio2(void); 73 extern char *test_fault1(void); 74 extern char *test_fault2(void); 75 extern char *test_vfs1(void); 76 extern char *test_ping_pong(void); 77 extern char *test_register(void); 78 extern char *test_connect(void); 79 extern char *test_loop1(void); 80 extern char *test_malloc1(void); 65 extern const char *test_thread1(void); 66 extern const char *test_print1(void); 67 extern const char *test_print2(void); 68 extern const char *test_print3(void); 69 extern const char *test_print4(void); 70 extern const char *test_console1(void); 71 extern const char *test_stdio1(void); 72 extern const char *test_stdio2(void); 73 extern const char *test_fault1(void); 74 extern const char *test_fault2(void); 75 extern const char *test_fault3(void); 76 extern const char *test_vfs1(void); 77 extern const char *test_ping_pong(void); 78 extern const char *test_register(void); 79 extern const char *test_connect(void); 80 extern const char *test_loop1(void); 81 extern const char *test_malloc1(void); 81 82 82 83 extern test_t tests[]; -
uspace/app/tester/thread/thread1.c
rcd82bb1 r371bd7d 50 50 } 51 51 52 c har *test_thread1(void)52 const char *test_thread1(void) 53 53 { 54 54 unsigned int i; 55 int total = 0;55 atomic_count_t total = 0; 56 56 57 57 atomic_set(&finish, 1); -
uspace/app/tester/vfs/vfs1.c
rcd82bb1 r371bd7d 30 30 #include <stdio.h> 31 31 #include <stdlib.h> 32 #include <str ing.h>32 #include <str.h> 33 33 #include <vfs/vfs.h> 34 34 #include <unistd.h> … … 54 54 static char text[] = "Lorem ipsum dolor sit amet, consectetur adipisicing elit"; 55 55 56 static c har *read_root(void)56 static const char *read_root(void) 57 57 { 58 58 TPRINTF("Opening the root directory..."); … … 73 73 } 74 74 75 c har *test_vfs1(void)75 const char *test_vfs1(void) 76 76 { 77 77 if (mkdir(MOUNT_POINT, 0) != 0) … … 79 79 TPRINTF("Created directory %s\n", MOUNT_POINT); 80 80 81 char null[MAX_DEVICE_NAME]; 82 int null_id = devmap_null_create(); 83 84 if (null_id == -1) 85 return "Unable to create null device"; 86 87 snprintf(null, MAX_DEVICE_NAME, "null%d", null_id); 88 int rc = mount(FS_TYPE, MOUNT_POINT, null, OPTIONS, FLAGS); 81 int rc = mount(FS_TYPE, MOUNT_POINT, "", OPTIONS, FLAGS); 89 82 switch (rc) { 90 83 case EOK: 91 TPRINTF("Mounted /dev/%s as %s on %s\n", null, FS_TYPE, MOUNT_POINT);84 TPRINTF("Mounted %s on %s\n", FS_TYPE, MOUNT_POINT); 92 85 break; 93 86 case EBUSY: … … 128 121 close(fd0); 129 122 130 c har *rv = read_root();123 const char *rv = read_root(); 131 124 if (rv != NULL) 132 125 return rv; -
uspace/app/tetris/Makefile
rcd82bb1 r371bd7d 28 28 # 29 29 30 include Makefile.common 30 USPACE_PREFIX = ../.. 31 BINARY = tetris 31 32 32 .PHONY: all clean 33 SOURCES = \ 34 shapes.c \ 35 scores.c \ 36 input.c \ 37 tetris.c \ 38 screen.c 33 39 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 37 38 clean: 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; 40 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/tetris/input.c
rcd82bb1 r371bd7d 52 52 #include <errno.h> 53 53 #include <unistd.h> 54 #include <str ing.h>54 #include <str.h> 55 55 56 56 #include "input.h" -
uspace/app/tetris/scores.c
rcd82bb1 r371bd7d 52 52 #include <errno.h> 53 53 #include <stdio.h> 54 #include <str ing.h>54 #include <str.h> 55 55 #include <io/console.h> 56 56 #include <io/keycode.h> -
uspace/app/tetris/scores.h
rcd82bb1 r371bd7d 48 48 49 49 #include <sys/time.h> 50 #include <str ing.h>50 #include <str.h> 51 51 52 52 #define MAXLOGNAME 16 -
uspace/app/tetris/screen.c
rcd82bb1 r371bd7d 49 49 #include <stdio.h> 50 50 #include <stdlib.h> 51 #include <str ing.h>51 #include <str.h> 52 52 #include <unistd.h> 53 53 #include <vfs/vfs.h> … … 72 72 * simply literal strings); 73 73 */ 74 static inline void putstr(c har *s)74 static inline void putstr(const char *s) 75 75 { 76 76 while (*s) … … 181 181 } 182 182 183 void stop(c har *why)183 void stop(const char *why) 184 184 { 185 185 if (isset) -
uspace/app/tetris/tetris.c
rcd82bb1 r371bd7d 53 53 #include <stdio.h> 54 54 #include <stdlib.h> 55 #include <str ing.h>55 #include <str.h> 56 56 #include <unistd.h> 57 57 #include <getopt.h> -
uspace/app/tetris/tetris.h
rcd82bb1 r371bd7d 186 186 extern int fits_in(const struct shape *, int); 187 187 extern void place(const struct shape *, int, int); 188 extern void stop(c har *);188 extern void stop(const char *); 189 189 190 190 /** @} -
uspace/app/trace/Makefile
rcd82bb1 r371bd7d 28 28 # 29 29 30 include Makefile.common 30 USPACE_PREFIX = ../.. 31 BINARY = trace 31 32 32 .PHONY: all clean 33 SOURCES = \ 34 trace.c \ 35 syscalls.c \ 36 ipcp.c \ 37 ipc_desc.c \ 38 proto.c \ 39 errors.c 33 40 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 37 38 clean: 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; 41 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/trace/errors.h
rcd82bb1 r371bd7d 37 37 38 38 typedef struct { 39 c har *name;/**< Error value name (Exx) */40 c har *desc;/**< Error description */39 const char *name; /**< Error value name (Exx) */ 40 const char *desc; /**< Error description */ 41 41 } err_desc_t; 42 42 -
uspace/app/trace/ipc_desc.h
rcd82bb1 r371bd7d 38 38 typedef struct { 39 39 int number; 40 c har *name;40 const char *name; 41 41 } ipc_m_desc_t; 42 42 -
uspace/app/trace/ipcp.c
rcd82bb1 r371bd7d 36 36 #include <stdlib.h> 37 37 #include <adt/hash_table.h> 38 #include <sys/typefmt.h> 38 39 39 40 #include "ipc_desc.h" … … 200 201 201 202 if ((display_mask & DM_IPC) != 0) { 202 printf("Call ID: 0x%lx, phone: %d, proto: %s, method: ", hash,203 printf("Call ID: %p, phone: %d, proto: %s, method: ", hash, 203 204 phone, (proto ? proto->name : "n/a")); 204 205 ipc_m_print(proto, IPC_GET_METHOD(*call)); 205 printf(" args: (%lu, %lu, %lu, %lu, %lu)\n", args[1], args[2], 206 printf(" args: (%" PRIuIPCARG ", %" PRIuIPCARG ", %" PRIuIPCARG 207 ", %" PRIuIPCARG ", %" PRIuIPCARG ")\n", args[1], args[2], 206 208 args[3], args[4], args[5]); 207 209 } … … 279 281 280 282 if ((display_mask & DM_IPC) != 0) { 281 printf("Response to 0x%lx: retval=%ld, args = (%lu, %lu, %lu, %lu, %lu)\n", 282 hash, retval, IPC_GET_ARG1(*answer), 283 IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer), 284 IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer)); 283 printf("Response to %p: retval=%ld, args = (%" PRIuIPCARG 284 ", %" PRIuIPCARG ", %" PRIuIPCARG ", %" PRIuIPCARG 285 ", %" PRIuIPCARG ")\n", 286 hash, retval, IPC_GET_ARG1(*answer), 287 IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer), 288 IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer)); 285 289 } 286 290 … … 336 340 /* Not a response */ 337 341 if ((display_mask & DM_IPC) != 0) { 338 printf("Not a response (hash 0x%lx)\n", hash);342 printf("Not a response (hash %p)\n", hash); 339 343 } 340 344 return; -
uspace/app/trace/proto.c
rcd82bb1 r371bd7d 157 157 } 158 158 159 static void proto_struct_init(proto_t *proto, c har *name)159 static void proto_struct_init(proto_t *proto, const char *name) 160 160 { 161 161 proto->name = name; … … 164 164 } 165 165 166 proto_t *proto_new(c har *name)166 proto_t *proto_new(const char *name) 167 167 { 168 168 proto_t *p; … … 206 206 } 207 207 208 static void oper_struct_init(oper_t *oper, c har *name)208 static void oper_struct_init(oper_t *oper, const char *name) 209 209 { 210 210 oper->name = name; 211 211 } 212 212 213 oper_t *oper_new(c har *name, int argc, val_type_t *arg_types,213 oper_t *oper_new(const char *name, int argc, val_type_t *arg_types, 214 214 val_type_t rv_type, int respc, val_type_t *resp_types) 215 215 { -
uspace/app/trace/proto.h
rcd82bb1 r371bd7d 43 43 44 44 typedef struct { 45 c har *name;45 const char *name; 46 46 47 47 int argc; … … 56 56 typedef struct { 57 57 /** Protocol name */ 58 c har *name;58 const char *name; 59 59 60 60 /** Maps method number to operation */ … … 70 70 void proto_register(int srv, proto_t *proto); 71 71 proto_t *proto_get_by_srv(int srv); 72 proto_t *proto_new(c har *name);72 proto_t *proto_new(const char *name); 73 73 void proto_delete(proto_t *proto); 74 74 void proto_add_oper(proto_t *proto, int method, oper_t *oper); 75 75 oper_t *proto_get_oper(proto_t *proto, int method); 76 76 77 oper_t *oper_new(c har *name, int argc, val_type_t *arg_types,77 oper_t *oper_new(const char *name, int argc, val_type_t *arg_types, 78 78 val_type_t rv_type, int respc, val_type_t *resp_types); 79 79 -
uspace/app/trace/syscalls.h
rcd82bb1 r371bd7d 39 39 40 40 typedef struct { 41 c har *name;41 const char *name; 42 42 int n_args; 43 43 val_type_t rv_type; -
uspace/app/trace/trace.c
rcd82bb1 r371bd7d 43 43 #include <task.h> 44 44 #include <mem.h> 45 #include <str ing.h>45 #include <str.h> 46 46 #include <bool.h> 47 47 #include <loader/loader.h> 48 48 #include <io/console.h> 49 49 #include <io/keycode.h> 50 #include <fibril_sync.h> 50 #include <fibril_synch.h> 51 #include <sys/types.h> 52 #include <sys/typefmt.h> 51 53 52 54 #include <libc.h> … … 159 161 if (rc < 0) { 160 162 printf("Error connecting\n"); 161 printf("ipc_connect_task(% lld) -> %d ", task_id, rc);163 printf("ipc_connect_task(%" PRIdTASKID ") -> %d ", task_id, rc); 162 164 return rc; 163 165 } … … 198 200 printf("Threads:"); 199 201 for (i = 0; i < n_threads; i++) { 200 printf(" [%d] (hash 0x%lx)", 1+i, thread_hash_buf[i]);202 printf(" [%d] (hash %p)", 1+i, thread_hash_buf[i]); 201 203 } 202 204 printf("\ntotal of %u threads\n", tb_needed / sizeof(uintptr_t)); … … 222 224 case V_HASH: 223 225 case V_PTR: 224 printf(" 0x%08lx", val);226 printf("%p", val); 225 227 break; 226 228 … … 275 277 276 278 putchar('('); 277 if (n > 0) printf("% ld", sc_args[0]);279 if (n > 0) printf("%" PRIdSYSARG, sc_args[0]); 278 280 for (i = 1; i < n; i++) { 279 printf(", % ld", sc_args[i]);281 printf(", %" PRIdSYSARG, sc_args[i]); 280 282 } 281 283 putchar(')'); … … 508 510 } 509 511 510 printf("Start tracing thread [%d] (hash 0x%lx).\n", thread_id, thread_hash);512 printf("Start tracing thread [%d] (hash %p).\n", thread_id, thread_hash); 511 513 512 514 while (!abort_trace) { … … 552 554 break; 553 555 case UDEBUG_EVENT_THREAD_E: 554 printf("Thread 0x%lxexited.\n", val0);556 printf("Thread %p exited.\n", val0); 555 557 fibril_mutex_lock(&state_lock); 556 558 abort_trace = true; … … 583 585 } 584 586 585 static loader_t *preload_task(const char *path, char * const argv[],587 static loader_t *preload_task(const char *path, char **argv, 586 588 task_id_t *task_id) 587 589 { … … 589 591 int rc; 590 592 591 /* Spawn a program loader */ 593 /* Spawn a program loader */ 592 594 ldr = loader_connect(); 593 595 if (ldr == NULL) … … 605 607 606 608 /* Send arguments */ 607 rc = loader_set_args(ldr, argv);609 rc = loader_set_args(ldr, (const char **) argv); 608 610 if (rc != EOK) 609 611 goto error; … … 868 870 } 869 871 870 static display_mask_t parse_display_mask(c har *text)872 static display_mask_t parse_display_mask(const char *text) 871 873 { 872 874 display_mask_t dm; 873 char *c; 874 875 c = text; 876 875 const char *c = text; 876 877 877 while (*c) { 878 878 switch (*c) { 879 case 't': dm = dm | DM_THREAD; break; 880 case 's': dm = dm | DM_SYSCALL; break; 881 case 'i': dm = dm | DM_IPC; break; 882 case 'p': dm = dm | DM_SYSTEM | DM_USER; break; 879 case 't': 880 dm = dm | DM_THREAD; 881 break; 882 case 's': 883 dm = dm | DM_SYSCALL; 884 break; 885 case 'i': 886 dm = dm | DM_IPC; 887 break; 888 case 'p': 889 dm = dm | DM_SYSTEM | DM_USER; 890 break; 883 891 default: 884 892 printf("Unexpected event type '%c'.\n", *c); 885 893 exit(1); 886 894 } 887 895 888 896 ++c; 889 897 } 890 898 891 899 return dm; 892 900 } … … 894 902 static int parse_args(int argc, char *argv[]) 895 903 { 896 char *arg;897 904 char *err_p; 898 905 899 906 task_id = 0; 900 907 901 --argc; ++argv; 908 --argc; 909 ++argv; 902 910 903 911 while (argc > 0) { 904 arg = *argv;912 char *arg = *argv; 905 913 if (arg[0] == '+') { 906 914 display_mask = parse_display_mask(&arg[1]); … … 908 916 if (arg[1] == 't') { 909 917 /* Trace an already running task */ 910 --argc; ++argv; 918 --argc; 919 ++argv; 911 920 task_id = strtol(*argv, &err_p, 10); 912 921 task_ldr = NULL; … … 925 934 break; 926 935 } 927 928 --argc; ++argv; 936 937 --argc; 938 ++argv; 929 939 } 930 940 931 941 if (task_id != 0) { 932 if (argc == 0) return 0; 942 if (argc == 0) 943 return 0; 933 944 printf("Extra arguments\n"); 934 945 print_syntax(); … … 944 955 /* Preload the specified program file. */ 945 956 printf("Spawning '%s' with arguments:\n", *argv); 946 { 947 char **cp = argv; 948 while (*cp) printf("'%s'\n", *cp++); 949 } 957 958 char **cp = argv; 959 while (*cp) 960 printf("'%s'\n", *cp++); 961 950 962 task_ldr = preload_task(*argv, argv, &task_id); 951 963 task_wait_for = true; … … 972 984 rc = connect_task(task_id); 973 985 if (rc < 0) { 974 printf("Failed connecting to task % lld.\n", task_id);986 printf("Failed connecting to task %" PRIdTASKID ".\n", task_id); 975 987 return 1; 976 988 } 977 989 978 printf("Connected to task % lld.\n", task_id);990 printf("Connected to task %" PRIdTASKID ".\n", task_id); 979 991 980 992 if (task_ldr != NULL)
Note:
See TracChangeset
for help on using the changeset viewer.
