finddir: added -l option; removed DOS CRLF; fixed coding style.
sysinfo: dump port info too by default git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8632 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+35
-2
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* finddir.c -
|
* finddir.c -
|
||||||
* (c) 2002, Sebastian Nozzi <[email protected]>
|
* (c) 2002, Sebastian Nozzi <[email protected]>
|
||||||
|
* 08/24/2004 - Francois Revol - added -l option.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
@@ -58,9 +59,34 @@ directoryType directoryTypes[] = {
|
|||||||
KEYVALUE_PAIR(B_USER_LIB_DIRECTORY),
|
KEYVALUE_PAIR(B_USER_LIB_DIRECTORY),
|
||||||
KEYVALUE_PAIR(B_USER_SETTINGS_DIRECTORY),
|
KEYVALUE_PAIR(B_USER_SETTINGS_DIRECTORY),
|
||||||
KEYVALUE_PAIR(B_USER_DESKBAR_DIRECTORY),
|
KEYVALUE_PAIR(B_USER_DESKBAR_DIRECTORY),
|
||||||
|
/* some more */
|
||||||
|
KEYVALUE_PAIR(B_BEOS_MEDIA_NODES_DIRECTORY),
|
||||||
|
KEYVALUE_PAIR(B_BEOS_SOUNDS_DIRECTORY),
|
||||||
|
KEYVALUE_PAIR(B_BEOS_TRANSLATORS_DIRECTORY),
|
||||||
|
KEYVALUE_PAIR(B_COMMON_MEDIA_NODES_DIRECTORY),
|
||||||
|
KEYVALUE_PAIR(B_COMMON_SOUNDS_DIRECTORY),
|
||||||
|
KEYVALUE_PAIR(B_COMMON_TRANSLATORS_DIRECTORY),
|
||||||
|
KEYVALUE_PAIR(B_USER_MEDIA_NODES_DIRECTORY),
|
||||||
|
KEYVALUE_PAIR(B_USER_PRINTERS_DIRECTORY),
|
||||||
|
KEYVALUE_PAIR(B_USER_SOUNDS_DIRECTORY),
|
||||||
|
KEYVALUE_PAIR(B_USER_TRANSLATORS_DIRECTORY),
|
||||||
|
KEYVALUE_PAIR(B_UTILITIES_DIRECTORY),
|
||||||
|
#ifdef B_BEOS_VERSION_DANO
|
||||||
|
/* Dano specific */
|
||||||
|
KEYVALUE_PAIR(B_ROOT_DIRECTORY),
|
||||||
|
#endif /* B_BEOS_VERSION_DANO */
|
||||||
{NULL,B_USER_DESKBAR_DIRECTORY}
|
{NULL,B_USER_DESKBAR_DIRECTORY}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void listDirectoryWhich(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; directoryTypes[i].key; i++) {
|
||||||
|
printf("%s\n", directoryTypes[i].key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool retrieveDirValue(directoryType *list, const char *key, directory_which *value_out)
|
bool retrieveDirValue(directoryType *list, const char *key, directory_which *value_out)
|
||||||
{
|
{
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
@@ -79,8 +105,10 @@ bool retrieveDirValue( directoryType *list, const char *key, directory_which *va
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void usageMsg(){
|
void usageMsg()
|
||||||
printf("usage: /bin/finddir [ -v volume ] directory_which\n" );
|
{
|
||||||
|
printf("usage: /bin/finddir -l | [ -v volume ] directory_which\n");
|
||||||
|
printf("\t-l\t list valid which constants to use\n");
|
||||||
printf("\t-v <file> use the specified volume for directory\n");
|
printf("\t-v <file> use the specified volume for directory\n");
|
||||||
printf("\t\t constants that are volume-specific.\n");
|
printf("\t\t constants that are volume-specific.\n");
|
||||||
printf("\t\t <file> can be any file on that volume.\n");
|
printf("\t\t <file> can be any file on that volume.\n");
|
||||||
@@ -113,6 +141,10 @@ int main(int argc, char *argv[])
|
|||||||
if (argc <= 1) {
|
if (argc <= 1) {
|
||||||
status = ARGUMENT_MISSING;
|
status = ARGUMENT_MISSING;
|
||||||
} else {
|
} else {
|
||||||
|
if (strcmp(argv[1], "-l") == 0 ) {
|
||||||
|
listDirectoryWhich();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (strcmp(argv[1], "-v") == 0 ) {
|
if (strcmp(argv[1], "-v") == 0 ) {
|
||||||
if (argc >= 3) {
|
if (argc >= 3) {
|
||||||
dev_t temp_volume;
|
dev_t temp_volume;
|
||||||
@@ -175,3 +207,4 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -412,6 +412,7 @@ static void dump_system_info(system_info *info)
|
|||||||
dump_cpu(info);
|
dump_cpu(info);
|
||||||
dump_mem(info);
|
dump_mem(info);
|
||||||
dump_sem(info);
|
dump_sem(info);
|
||||||
|
dump_ports(info);
|
||||||
dump_thread(info);
|
dump_thread(info);
|
||||||
dump_team(info);
|
dump_team(info);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user