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