2 * Copyright 2005, Haiku.
3 * Distributed under the terms of the MIT License.
6 * Axel Dörfler, axeld@pinc-software.de
23 extern const char* __progname
;
27 skip_white_space(char*& line
)
29 while (isspace(line
[0]))
37 while (isalnum(line
[0]) || line
[0] == '_') {
46 print_code(BPath
& path
, int32 code
)
48 FILE* file
= fopen(path
.Path(), "r");
55 while (fgets(buffer
, sizeof(buffer
), file
) != NULL
) {
57 skip_white_space(line
);
59 if (strncmp(line
, "AS_", 3))
62 if (++lineNumber
!= code
)
66 printf("code %ld: %s\n", lineNumber
, line
);
71 printf("unknown code %ld!\n", code
);
77 main(int argc
, char** argv
)
80 fprintf(stderr
, "usage: %s <message-code>\n", __progname
);
84 int32 number
= atol(argv
[1]);
87 query
.SetPredicate("name=ServerProtocol.h");
89 // search on current volume only
90 dev_t device
= dev_for_path(".");
91 BVolume
volume(device
);
93 query
.SetVolume(&volume
);
98 while ((status
= query
.GetNextEntry(&entry
)) == B_OK
) {
101 if (strstr(path
.Path(), "headers/private/app/ServerProtocol.h") != NULL
) {
102 print_code(path
, number
);
107 if (status
!= B_OK
) {
108 fprintf(stderr
, "%s: could not find ServerProtocol.h", __progname
);