/* df - summarize free disk space Copyright (C) 1995-1998 Steven Pritchard Portions Copyright (C) 91, 95, 1996 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Written by Steven Pritchard . "Inspired" by df.c from GNU fileutils 3.9 and 3.16. */ #include #include #include #include #include static void print_header(void); static void print_DOS_header(void); int getOS(void); int show_dev_NT(unsigned int, char *); int show_dev_DOS(unsigned int, char *, char *); static int kilobyte_blocks=1; int main(int argc, char **argv) { DWORD drive_mask; unsigned int n; char root[7]; char *NT_device=NULL; char *label=NULL; int isNT; unsigned long total, avail; DWORD sectors, bytes, free_clusters, total_clusters; isNT=getOS(); if (isNT==-1) { fprintf(stderr, "Unable to determine OS type\n"); exit(EXIT_FAILURE); } if (isNT) { print_header(); } else { print_DOS_header(); } drive_mask=GetLogicalDrives(); SetErrorMode(SEM_FAILCRITICALERRORS); for (n=0;n<26;n++) { if (drive_mask & (1<