mount.c 606 B

1234567891011121314151617181920212223242526272829
  1. /* vim: tabstop=4 shiftwidth=4 noexpandtab
  2. * This file is part of ToaruOS and is released under the terms
  3. * of the NCSA / University of Illinois License - see LICENSE.md
  4. * Copyright (C) 2014-2018 K. Lange
  5. *
  6. * mount
  7. *
  8. * Mount a filesystem.
  9. */
  10. #include <stdio.h>
  11. #include <errno.h>
  12. #include <sys/mount.h>
  13. int main(int argc, char ** argv) {
  14. if (argc < 4) {
  15. fprintf(stderr, "Usage: %s type device mountpoint\n", argv[0]);
  16. return 1;
  17. }
  18. int ret = mount(argv[2], argv[3], argv[1], 0, NULL);
  19. if (ret < 0) {
  20. fprintf(stderr, "%s: %s\n", argv[0], strerror(errno));
  21. return ret;
  22. }
  23. return 0;
  24. }