Changeset 8fab3f6 in mainline for uspace/app/sysctl/main.c
- Timestamp:
- 2019-08-17T13:50:05Z (6 years ago)
- Children:
- 31ef7c1
- Parents:
- 504d103
- git-author:
- Michal Koutný <xm.koutny+hos@…> (2015-12-04 17:21:21)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-17 13:50:05)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sysctl/main.c
r504d103 r8fab3f6 97 97 } 98 98 99 static int start(int argc, char *argv[]) 100 { 101 unit_handle_t handle; 102 char *unit_name = argv[1]; 103 104 int rc = sysman_unit_handle(unit_name, &handle); 105 if (rc != EOK) { 106 printf("Cannot obtain handle for unit '%s' (%s).\n", 107 unit_name, str_error(rc)); 108 return rc; 109 } 110 111 rc = sysman_unit_start(handle, IPC_FLAG_BLOCKING); 112 if (rc != EOK) { 113 printf("Error when starting unit '%s' error (%s).\n", 114 unit_name, str_error(rc)); 115 return rc; 116 } 117 118 return 0; 119 } 120 99 121 static int stop(int argc, char *argv[]) 100 122 { … … 111 133 rc = sysman_unit_stop(handle, IPC_FLAG_BLOCKING); 112 134 if (rc != EOK) { 113 printf("Error when stopping unit '%s' handle(%s).\n",135 printf("Error when stopping unit '%s' error (%s).\n", 114 136 unit_name, str_error(rc)); 115 137 return rc; … … 121 143 command_t commands[] = { 122 144 { "list-units", 0, &list_units }, 145 { "start", 1, &start }, 123 146 { "stop", 1, &stop }, 124 147 { 0 } … … 127 150 static void print_syntax(void) 128 151 { 129 printf("syntax:\n"); 130 printf("\t%s\n", NAME); 131 // TODO update as functionality grows 152 printf("%s commands:\n", NAME); 153 for (command_t *it = commands; it->name != NULL; ++it) { 154 printf("\t%s", it->name); 155 for (int i = 0; i < it->args; ++i) { 156 printf(" <arg%i>", i + 1); 157 } 158 printf("\n"); 159 } 132 160 } 133 161
Note:
See TracChangeset
for help on using the changeset viewer.