2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2016 Kern Sibbald
6 The original author of Bacula is Kern Sibbald, with contributions
7 from many others, a complete list can be found in the file AUTHORS.
9 You may use this file and others of this release according to the
10 license defined in the LICENSE file, which includes the Affero General
11 Public License, v3.0 ("AGPLv3") and some additional permissions and
12 terms pursuant to its AGPLv3 Section 7.
14 This notice must be preserved when any source code is
15 conveyed and/or propagated.
17 Bacula(R) is a registered trademark of Kern Sibbald.
20 * Program for determining drive type
22 * Written by Robert Nelson, June 2006
26 #include "findlib/find.h"
32 "Usage: drivetype [-v] path ...\n"
34 " Print the drive type a given file/directory is on.\n"
35 " The following options are supported:\n"
37 " -l print local fixed hard drive\n"
38 " -a display information on all drives\n"
39 " -v print both path and file system type.\n"
40 " -? print this message.\n"
46 int display_drive(char *drive, bool display_local, int verbose)
51 if (drivetype(drive, dt, sizeof(dt))) {
52 if (display_local) { /* in local mode, display only harddrive */
53 if (strcmp(dt, "fixed") == 0) {
54 printf("%s\n", drive);
57 printf("%s: %s\n", drive, dt);
61 } else if (!display_local) { /* local mode is used by FileSet scripts */
62 fprintf(stderr, _("%s: unknown\n"), drive);
69 main (int argc, char *const *argv)
74 bool display_local = false;
75 bool display_all = false;
79 setlocale(LC_ALL, "");
80 bindtextdomain("bacula", LOCALEDIR);
83 while ((ch = getopt(argc, argv, "alv?")) != -1) {
105 if (argc < 1 && display_all) {
106 /* Try all letters */
107 for (drive = 'A'; drive <= 'Z'; drive++) {
108 bsnprintf(buf, sizeof(buf), "%c:/", drive);
109 display_drive(buf, display_local, verbose);
118 for (i = 0; i < argc; --argc, ++argv) {
119 status += display_drive(*argv, display_local, verbose);