From 7e0f021a9aec35fd8e6725e87e3313b101d26f5e Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sun, 27 Jan 2008 11:37:44 +0100 Subject: Initial import (2.0.2-6) --- reference/C/CONTRIB/SNIP/drvs.c | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 reference/C/CONTRIB/SNIP/drvs.c (limited to 'reference/C/CONTRIB/SNIP/drvs.c') diff --git a/reference/C/CONTRIB/SNIP/drvs.c b/reference/C/CONTRIB/SNIP/drvs.c new file mode 100755 index 0000000..2002d8c --- /dev/null +++ b/reference/C/CONTRIB/SNIP/drvs.c @@ -0,0 +1,43 @@ +/* +** DRVS.C - public domain by David Gersic, DeKalb, Il 1993 +** +** Routine checks how many valid disk drives are available on machine, +** both physical and logical drives. +** +** Includes drive letters assigned with DOS SUBST command and network +** drives for Novell Netware (and probably other networks). +** +** Compiled Under MSC 6 LARGE memory Model +** Should be compatible with other DOS compilers +** +*/ + +#include +#include +#include + +main() +{ + union REGS in, out; + int i; + + /* Novell's shell TSRs allow up to 32 drive 'letters' to be created */ + + char drives[]={' ','a','b','c','d','e','f','g','h','i','j', + 'k','l','m','n','o','p','q','r','s','t','u', + 'v','w','x','y','z','[','\\',']','^','_','`'}; + + in.x.ax=0x4409; /* IOCTL function - Check if block device remote */ + for(i = 1; i < 32; i++) + { + in.h.bl=(unsigned char)i; /* 1==a:, 2==b:, etc. */ + intdos(&in,&out); + if(!out.x.cflag) /* carry flag set on error */ + { /* bit 15 == subst, bit 12 == 'remote'*/ + printf("drive %c: is %s\n", + drives[i],out.x.dx & 1<<15 ? "subst" : + out.x.dx & 1<<12 ? "network" : "local"); + } + } + return(0); +} -- cgit v1.2.3-54-g00ecf