Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : PCCAPP.ZIP
Filename : CD.CC

 
Output of file : CD.CC contained in archive : PCCAPP.ZIP
/*
* This file is part of the Choices Operating System
* Developed by: The TAPESTRY Parallel Computing Laboratory
* University of Illinois at Urbana-Champaign
* Department of Computer Science
* 1304 W. Springfield Ave.
* Urbana, IL 61801
*
* Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992
* The University of Illinois Board of Trustees.
* All Rights Reserved.
*
* Author: Lee Lup Yuen ([email protected])
* Project Manager and Principal Investigator: Roy Campbell ([email protected])
*
* Funded by: NSF TAPESTRY Grant No. 1-5-30035, NASA ICLASS Grant
* No. 1-5-25469 and No. NSG1471 and AT&T Metronet Grant No. 1-5-37411.
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for educational, research, and non-profit purposes
* is hereby granted provided that the above copyright notice, the
* original authors names, and this permission notice appear in all such
* copies and supporting documentation; that no charge be made for such
* copies; and that the name of the University of Illinois not be used
* in advertising or publicity pertaining to distribution of the
* software without specific prior written permission. Any entity
* desiring permission to incorporate this software into commercial
* products should contact the Computing Research Laboratory, Department
* of Computer Science, University of Illinois, 1304 W. Springfield
* Avenue, Urbana, IL 61801. The University of Illinois makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/

#include "FileSystemInterface.h"
#include "NameServer.h"
#include "OutputStream.h"
#include "VirtualPCInterface.h"
#include "VirtualPCInterfaceStar.h"
#include "VirtualPCArgs.h"
#include "Assert.h"

int printCurrentDirectory ();
void translatePathname (char *path);
void reverseTranslatePathname (char *path);

int main (int argc, char **argv)
{
// If no arguments, then print the current directory. Otherwise
// change to the directory specified by the first argument.
if (argc <= 0) return 1;
else if (argc == 1) return printCurrentDirectory ();
translatePathname (argv [1]);
StandardFileSystemInterface -> chdir (argv [1]);
return 0;
}

int printCurrentDirectory ()
{
// Call DOS to find out the current directory. Print its name.
VirtualPCInterfaceStar virtualPC = (VirtualPCInterfaceStar)
StandardNameServer -> lookup ("virtualPCInterface",
"VirtualPCInterface");
Assert (virtualPC != 0);
VirtualPCArgs args;
// Call DOS to find the current drive.
args.set (rAX, 0x1900); // DOS function 0x19.
int err = virtualPC -> executeVector (DOSVector, &args);
if (err) return 2;
*StandardOutput << "Current directory is " << (char) ((args.get (rAX) &
0xff) + 'A') << ":/";
// Call DOS to find the current directory.
char dirname [64];
args.reset ();
args.set (rAX, 0x4700); // DOS function 0x47.
args.set (rDX, 0);
args.setUninitBuffer (rDS, rSI, dirname, 64);
err = virtualPC -> executeVector (DOSVector, &args);
if (err || (args.get (rFlags) & 1)) return 2;
reverseTranslatePathname (dirname);
*StandardOutput << dirname << "\n" << eor;
return 0;
}

void translatePathname (char *path)
{
// Change all '/' in path to '\'.
for (char *s = path; *s != 0; s++)
if (*s == '/') *s = '\\';
}

void reverseTranslatePathname (char *path)
{
// Change all '\' in path to '/'. Also, all letters are converted
// to lowercase except for the first character in path and the first
// character following each '\'.
int capitalize = 1;
for (char *s = path; *s != 0; s++)
{
if (*s == '\\') { *s = '/'; capitalize = 1; }
else if (capitalize) { capitalize = 0; }
else if (*s >= 'A' && *s <= 'Z') *s = *s - 'A' + 'a';
}
}


  3 Responses to “Category : Alternate Operating Systems - Quarterdeck DesqView, CP/M, etc
Archive   : PCCAPP.ZIP
Filename : CD.CC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/