update main #1

Merged
Sinipelto merged 240 commits from Bananymous/banan-os:main into main 2023-11-20 13:20:51 +02:00
1 changed files with 25 additions and 2 deletions
Showing only changes of commit ec2baeb276 - Show all commits

View File

@ -1,6 +1,29 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h> #include <unistd.h>
int main() void usage(int ret, char* cmd)
{ {
sync(); FILE* fout = (ret == 0) ? stdout : stderr;
fprintf(fout, "usage: %s [OPTION]...\n", cmd);
fprintf(fout, "Tells the kernel to start a disk sync as soon as possible\n");
fprintf(fout, " -b, --block return only after sync is complete\n");
fprintf(fout, " -h, --help show this message and exit\n");
exit(ret);
}
int main(int argc, char** argv)
{
bool block = false;
for (int i = 1; i < argc; i++)
{
if (strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "--block") == 0)
block = true;
else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
usage(0, argv[0]);
else
usage(1, argv[0]);
}
syncsync(block);
return 0;
} }