diff --git a/build/jam/Haiku64Image b/build/jam/Haiku64Image index cb0311c51e..43741e0225 100644 --- a/build/jam/Haiku64Image +++ b/build/jam/Haiku64Image @@ -19,14 +19,19 @@ if $(HAIKU_ATA_STACK) = 1 { IDE_ONLY = "" ; } -SYSTEM_BIN = "[" base64 basename bash cat chgrp chmod chown chroot cksum comm - cp split cut date dd dircolors dirname du echo env expand expr factor false - fmt fold getlimits groups head hostname id install join kill link - ln locale logname ls md5sum mkdir mkfifo mktemp mv nl nohup nproc od paste - pathchk pr printenv printf ps ptx pwd readlink rm rmdir safemode seq +SYSTEM_BIN = "[" addattr base64 basename bash beep cal cat catattr chgrp chmod + chown chroot cksum clear clockconfig cmp collectcatkeys comm compress + copyattr cp csplit cut date dd diff diff3 dircolors dirname du + dumpcatalog echo eject env error expand expr factor false find finddir + fmt fold fortune gawk gzip gzexe getlimits groups head hostname id + install isvolume join kernel_debugger kill less lessecho lesskey link + linkcatkeys listdev ln locale locate logger logname ls md5sum mkdir mkfifo + mktemp mount mountvolume mv nl nohup nproc od paste patch pathchk pr + printenv printf ps ptx pwd readlink rm rmattr rmdir safemode sdiff seq sha1sum shred shuf sleep sort split stat stty su sum sync sysinfo tac tail tee test timeout touch tr true truncate tsort tty unexpand uname uniq - unlink wc whoami yes + unlink unmount unzip updatedb waitfor wc whoami xargs xres yes + zdiff zforce zgrep zip zipcloak zipgrep zipnote zipsplit zmore znew ; SYSTEM_APPS = ; diff --git a/src/bin/catattr.cpp b/src/bin/catattr.cpp index 568c0031cc..eab474f8e8 100644 --- a/src/bin/catattr.cpp +++ b/src/bin/catattr.cpp @@ -43,7 +43,7 @@ dumpRawData(const char *buffer, size_t size) while (dumpPosition < size) { // Position for this line - printf("0x%06lx: ", dumpPosition); + printf("0x%06" B_PRIx32 ": ", dumpPosition); // Print the bytes in form of hexadecimal numbers for (uint32 i = 0; i < kChunkSize; i++) { @@ -88,7 +88,7 @@ type_to_string(uint32 type) sprintf(buffer, "'%c%c%c%c'", value[0], value[1], value[2], value[3]); } else - sprintf(buffer, "0x%08lx", type); + sprintf(buffer, "0x%08" B_PRIx32, type); return buffer; } @@ -218,28 +218,28 @@ catAttr(const char *attribute, const char *fileName, bool keepRaw, switch (info.type) { case B_INT8_TYPE: - printf("%d\n", *((int8*)buffer)); + printf("%" B_PRId8 "\n", *((int8*)buffer)); break; case B_UINT8_TYPE: - printf("%u\n", *((uint8*)buffer)); + printf("%" B_PRIu8 "\n", *((uint8*)buffer)); break; case B_INT16_TYPE: - printf("%d\n", *((int16*)buffer)); + printf("%" B_PRId16 "\n", *((int16*)buffer)); break; case B_UINT16_TYPE: - printf("%u\n", *((uint16*)buffer)); + printf("%" B_PRIu16 "\n", *((uint16*)buffer)); break; case B_INT32_TYPE: - printf("%ld\n", *((int32*)buffer)); + printf("%" B_PRId32 "\n", *((int32*)buffer)); break; case B_UINT32_TYPE: - printf("%lu\n", *((uint32*)buffer)); + printf("%" B_PRIu32 "\n", *((uint32*)buffer)); break; case B_INT64_TYPE: - printf("%Ld\n", *((int64*)buffer)); + printf("%" B_PRId64 "\n", *((int64*)buffer)); break; case B_UINT64_TYPE: - printf("%Lu\n", *((uint64*)buffer)); + printf("%" B_PRIu64 "\n", *((uint64*)buffer)); break; case B_FLOAT_TYPE: printf("%f\n", *((float*)buffer)); diff --git a/src/bin/clockconfig.cpp b/src/bin/clockconfig.cpp index 8acb56afc9..78c73520f7 100644 --- a/src/bin/clockconfig.cpp +++ b/src/bin/clockconfig.cpp @@ -73,7 +73,7 @@ setTimeZoneOffset(BPath path) _kern_set_timezone(timeZoneOffset, timeZoneID.String(), timeZoneID.Length()); - printf("timezone is %s, offset is %ld seconds from GMT.\n", + printf("timezone is %s, offset is %" B_PRId32 " seconds from GMT.\n", timeZoneID.String(), timeZoneOffset); } diff --git a/src/bin/error.c b/src/bin/error.c index ff2b98c8d5..c18a71e237 100644 --- a/src/bin/error.c +++ b/src/bin/error.c @@ -320,7 +320,7 @@ print_error(char *number) error = p->value; } - printf("0x%lx: %s\n", error, strerror(error)); + printf("0x%" B_PRIx32 ": %s\n", error, strerror(error)); } diff --git a/src/bin/isvolume.cpp b/src/bin/isvolume.cpp index 0d4c0b9455..a7a8b89103 100644 --- a/src/bin/isvolume.cpp +++ b/src/bin/isvolume.cpp @@ -93,8 +93,8 @@ main(int argc, char** argv) BVolume volume(volumeDevice); status_t ret = volume.InitCheck(); if (ret != B_OK) { - fprintf(stderr, "%s: failed to get BVolume for device %ld: %s\n", - argv[0], volumeDevice, strerror(ret)); + fprintf(stderr, "%s: failed to get BVolume for device %" B_PRIdDEV + ": %s\n", argv[0], volumeDevice, strerror(ret)); return 1; } @@ -103,8 +103,8 @@ main(int argc, char** argv) BPartition* partition; ret = roster.FindPartitionByVolume(volume, &diskDevice, &partition); if (ret != B_OK) { - fprintf(stderr, "%s: failed to get partition for device %ld: %s\n", - argv[0], volumeDevice, strerror(ret)); + fprintf(stderr, "%s: failed to get partition for device %" B_PRIdDEV + ": %s\n", argv[0], volumeDevice, strerror(ret)); return 1; } // check this option directly and not via fs_stat_dev() @@ -122,8 +122,8 @@ main(int argc, char** argv) return 0; } else { - fprintf(stderr, "%s: can't get information about dev_t: %ld\n", - argv[0], volumeDevice); + fprintf(stderr, "%s: can't get information about dev_t: %" B_PRIdDEV + "\n", argv[0], volumeDevice); return 1; } } diff --git a/src/bin/listattr.cpp b/src/bin/listattr.cpp index 77ea615dd8..13e4010828 100644 --- a/src/bin/listattr.cpp +++ b/src/bin/listattr.cpp @@ -29,7 +29,7 @@ dump_raw_data(const char *buffer, size_t size) while (dumpPosition < size) { // Position for this line - printf("\t%04lx: ", dumpPosition); + printf("\t%04" B_PRIx32 ": ", dumpPosition); // Print the bytes in form of hexadecimal numbers for (uint32 i = 0; i < kChunkSize; i++) { @@ -72,35 +72,35 @@ show_attr_contents(BNode& node, const char* attribute, const attr_info& info) char buffer[kLimit]; ssize_t bytesRead = node.ReadAttr(attribute, info.type, 0, buffer, size); if (bytesRead != size) { - fprintf(stderr, "Could only read %lld bytes from attribute!\n", + fprintf(stderr, "Could only read %" B_PRIdOFF " bytes from attribute!\n", size); return; } switch (info.type) { case B_INT8_TYPE: - printf("%d\n", *((int8 *)buffer)); + printf("%" B_PRId8 "\n", *((int8 *)buffer)); break; case B_UINT8_TYPE: - printf("%u\n", *((uint8 *)buffer)); + printf("%" B_PRIu8 "\n", *((uint8 *)buffer)); break; case B_INT16_TYPE: - printf("%d\n", *((int16 *)buffer)); + printf("%" B_PRId16 "\n", *((int16 *)buffer)); break; case B_UINT16_TYPE: - printf("%u\n", *((uint16 *)buffer)); + printf("%" B_PRIu16 "\n", *((uint16 *)buffer)); break; case B_INT32_TYPE: - printf("%ld\n", *((int32 *)buffer)); + printf("%" B_PRId32 "\n", *((int32 *)buffer)); break; case B_UINT32_TYPE: - printf("%lu\n", *((uint32 *)buffer)); + printf("%" B_PRIu32 "\n", *((uint32 *)buffer)); break; case B_INT64_TYPE: - printf("%lld\n", *((int64 *)buffer)); + printf("%" B_PRId64 "\n", *((int64 *)buffer)); break; case B_UINT64_TYPE: - printf("%llu\n", *((uint64 *)buffer)); + printf("%" B_PRIu64 "\n", *((uint64 *)buffer)); break; case B_FLOAT_TYPE: printf("%f\n", *((float *)buffer)); @@ -198,7 +198,7 @@ get_type(type_code type) sprintf(buffer, "'%c%c%c%c'", value[0], value[1], value[2], value[3]); } else - sprintf(buffer, "0x%08lx", type); + sprintf(buffer, "0x%08" B_PRIx32, type); return buffer; } @@ -262,7 +262,7 @@ main(int argc, char *argv[]) status = node.GetAttrInfo(name, &attrInfo); if (status >= B_OK) { printf("%*s", kTypeWidth, get_type(attrInfo.type)); - printf("% *Li ", kSizeWidth, attrInfo.size); + printf("% *" B_PRId64 " ", kSizeWidth, attrInfo.size); printf("\"%s\"", name); if (printContents) { @@ -283,6 +283,6 @@ main(int argc, char *argv[]) } } - printf("\n%Ld bytes total in attributes.\n", total); + printf("\n%" B_PRId64 " bytes total in attributes.\n", total); return 0; } diff --git a/src/bin/listdev/listdev.c b/src/bin/listdev/listdev.c index f582d0fa5d..77cc02a532 100644 --- a/src/bin/listdev/listdev.c +++ b/src/bin/listdev/listdev.c @@ -87,16 +87,20 @@ dump_attribute(struct device_attr_info *attr, int32 level) printf("string : \"%s\"", attr->value.string); break; case B_UINT8_TYPE: - printf("uint8 : %u (%#x)", attr->value.ui8, attr->value.ui8); + printf("uint8 : %" B_PRIu8 " (%#" B_PRIx8 ")", attr->value.ui8, + attr->value.ui8); break; case B_UINT16_TYPE: - printf("uint16 : %u (%#x)", attr->value.ui16, attr->value.ui16); + printf("uint16 : %" B_PRIu16 " (%#" B_PRIx16 ")", attr->value.ui16, + attr->value.ui16); break; case B_UINT32_TYPE: - printf("uint32 : %lu (%#lx)", attr->value.ui32, attr->value.ui32); + printf("uint32 : %" B_PRIu32 " (%#" B_PRIx32 ")", attr->value.ui32, + attr->value.ui32); break; case B_UINT64_TYPE: - printf("uint64 : %Lu (%#Lx)", attr->value.ui64, attr->value.ui64); + printf("uint64 : %" B_PRIu64 " (%#" B_PRIx64 ")", attr->value.ui64, + attr->value.ui64); break; default: printf("raw data"); diff --git a/src/bin/locale/collectcatkeys.cpp b/src/bin/locale/collectcatkeys.cpp index 06156c8d6c..e8ded99946 100644 --- a/src/bin/locale/collectcatkeys.cpp +++ b/src/bin/locale/collectcatkeys.cpp @@ -184,11 +184,11 @@ collectAllCatalogKeys(BString& inputStr) if (fetchKey(in)) { if (haveID) { if (showKeys) - printf("CatKey(%ld)\n", id); + printf("CatKey(%" B_PRId32 ")\n", id); res = catalog->SetString(id, ""); if (res != B_OK) { - fprintf(stderr, "couldn't add key %ld - error: %s\n", - id, strerror(res)); + fprintf(stderr, "couldn't add key %" B_PRId32 " - error: " + "%s\n", id, strerror(res)); exit(-1); } } else { @@ -285,8 +285,8 @@ main(int argc, char **argv) char *buf = inputStr.LockBuffer(sz); off_t rsz = inFile.Read(buf, sz); if (rsz < sz) { - fprintf(stderr, "couldn't read %Ld bytes from %s (got only %Ld)\n", - sz, inputFile, rsz); + fprintf(stderr, "couldn't read %" B_PRId64 " bytes from %s (got " + "only %" B_PRId64 ")\n", sz, inputFile, rsz); exit(-1); } inputStr.UnlockBuffer(rsz); @@ -301,7 +301,7 @@ main(int argc, char **argv) if (showSummary) { int32 count = catalog->CountItems(); if (count) - fprintf(stderr, "%ld key%s found and written to %s\n", + fprintf(stderr, "%" B_PRId32 " key%s found and written to %s\n", count, (count==1 ? "": "s"), outputFile.String()); else fprintf(stderr, "no keys found\n"); diff --git a/src/bin/locale/dumpcatalog.cpp b/src/bin/locale/dumpcatalog.cpp index b1f58b6054..d90f790bdc 100644 --- a/src/bin/locale/dumpcatalog.cpp +++ b/src/bin/locale/dumpcatalog.cpp @@ -64,15 +64,16 @@ main(int argc, char **argv) while (!walker.AtEnd()) { const CatKey &key(walker.GetKey()); key.GetStringParts(&str, &ctx, &cmt); - printf("Hash:\t\t%lu\nKey:\t\t<%s:%s:%s>\nTranslation:\t%s\n-----\n", - key.fHashVal, str.String(), ctx.String(), cmt.String(), + printf("Hash:\t\t%" B_PRIu32 "\nKey:\t\t<%s:%s:%s>\nTranslation:\t%s\n" + "-----\n", key.fHashVal, str.String(), ctx.String(), cmt.String(), walker.GetValue()); walker.Next(); } int32 count = inputCatalog.CountItems(); - if (count) - fprintf(stderr, "%ld entr%s dumped\n", count, (count==1 ? "y": "ies")); - else + if (count) { + fprintf(stderr, "%" B_PRId32 " entr%s dumped\n", count, + (count==1 ? "y": "ies")); + } else fprintf(stderr, "no entries found\n"); return res; } diff --git a/src/bin/locale/linkcatkeys.cpp b/src/bin/locale/linkcatkeys.cpp index 0fe8ac9b2f..be81f5a948 100644 --- a/src/bin/locale/linkcatkeys.cpp +++ b/src/bin/locale/linkcatkeys.cpp @@ -180,7 +180,7 @@ main(int argc, char **argv) if (showSummary) { int32 count = targetCatalog.CountItems(); if (count) { - fprintf(stderr, "%ld key%s found and written to %s\n", + fprintf(stderr, "%" B_PRId32 " key%s found and written to %s\n", count, (count==1 ? "": "s"), outputFile.String()); } else fprintf(stderr, "no keys found\n"); diff --git a/src/bin/mountvolume.cpp b/src/bin/mountvolume.cpp index d3c2be3378..b9bd217749 100644 --- a/src/bin/mountvolume.cpp +++ b/src/bin/mountvolume.cpp @@ -99,7 +99,7 @@ size_string(int64 size) static char string[64]; if (size < 1024) - sprintf(string, "%Ld", size); + sprintf(string, "%" B_PRId64, size); else { const char* units[] = {"K", "M", "G", NULL}; int32 i = -1; diff --git a/src/bin/ps.c b/src/bin/ps.c index 92416ceb96..078a636008 100644 --- a/src/bin/ps.c +++ b/src/bin/ps.c @@ -28,8 +28,8 @@ printTeamInfo(team_info *teamInfo, bool printHeader) printf("%-50s %5s %8s %4s %4s\n", "Team", "Id", "#Threads", "Gid", \ "Uid"); - printf("%-50s %5ld %8ld %4d %4d\n", teamInfo->args, teamInfo->team, - teamInfo->thread_count, teamInfo->uid, teamInfo->gid); + printf("%-50s %5" B_PRId32 " %8" B_PRId32 " %4d %4d\n", teamInfo->args, + teamInfo->team, teamInfo->thread_count, teamInfo->uid, teamInfo->gid); } @@ -37,7 +37,7 @@ static void printTeamThreads(team_info *teamInfo, bool printSemaphoreInfo) { char *threadState; - uint32 threadCookie = 0; + int32 threadCookie = 0; sem_info semaphoreInfo; thread_info threadInfo; @@ -51,18 +51,21 @@ printTeamThreads(team_info *teamInfo, bool printSemaphoreInfo) else threadState = sStates[threadInfo.state - 1]; - printf("%-37s %5ld %8s %4ld %8llu %8llu ", - threadInfo.name, threadInfo.thread, threadState, + printf("%-37s %5" B_PRId32 " %8s %4" B_PRId32 " %8" B_PRIu64 " %8" + B_PRId64 " ", threadInfo.name, threadInfo.thread, threadState, threadInfo.priority, (threadInfo.user_time / 1000), (threadInfo.kernel_time / 1000)); if (printSemaphoreInfo) { if (threadInfo.state == B_THREAD_WAITING && threadInfo.sem != -1) { status_t status = get_sem_info(threadInfo.sem, &semaphoreInfo); - if (status == B_OK) - printf("%s(%ld)\n", semaphoreInfo.name, semaphoreInfo.sem); - else - printf("%s(%ld)\n", strerror(status), threadInfo.sem); + if (status == B_OK) { + printf("%s(%" B_PRId32 ")\n", semaphoreInfo.name, + semaphoreInfo.sem); + } else { + printf("%s(%" B_PRId32 ")\n", strerror(status), + threadInfo.sem); + } } else puts(""); } else @@ -74,7 +77,7 @@ int main(int argc, char **argv) { team_info teamInfo; - uint32 teamCookie = 0; + int32 teamCookie = 0; system_info systemInfo; bool printSystemInfo = false; bool printThreads = false; @@ -153,13 +156,13 @@ main(int argc, char **argv) // system stats get_system_info(&systemInfo); printf("\nSystem Info\n"); - printf("%luk (%lu bytes) total memory\n", + printf("%" B_PRIu32 "k (%" B_PRIu32 " bytes) total memory\n", (systemInfo.max_pages * B_PAGE_SIZE / 1024), (systemInfo.max_pages * B_PAGE_SIZE)); - printf("%luk (%lu bytes) currently committed\n", + printf("%" B_PRIu32 "k (%" B_PRIu32 " bytes) currently committed\n", (systemInfo.used_pages * B_PAGE_SIZE / 1024), (systemInfo.used_pages * B_PAGE_SIZE)); - printf("%luk (%lu bytes) currently available\n", + printf("%" B_PRIu32 "k (%" B_PRIu32 " bytes) currently available\n", (systemInfo.max_pages - systemInfo.used_pages) * B_PAGE_SIZE / 1024, (systemInfo.max_pages - systemInfo.used_pages) * B_PAGE_SIZE); printf("%2.1f%% memory utilisation\n",