home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************/
- /* */
- /* type.c */
- /* */
- /* command.com type command */
- /* */
- /* Copyright (c) 2000 */
- /* Pasquale J. Villani */
- /* All Rights Reserved */
- /* */
- /* This file is part of CMD32. */
- /* */
- /* CMD32 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. */
- /* */
- /* CMD32 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 CMD32; see the file COPYING. If not, */
- /* write to the Free Software Foundation, 675 Mass Ave, */
- /* Cambridge, MA 02139, USA. */
- /****************************************************************/
-
- /* $Logfile$ */
-
- /* $Log$
- * $EndLog$ */
-
- #ifdef VERSION_STRINGS
- static char *RcsId = "$Header$";
- #endif
-
- #include <windows.h>
- #include "globals.h"
- #include "proto.h"
-
- #define CTL_Z 0x1a
-
- BOOL type(INT argc, BYTE *argv[])
- {
- HANDLE hFile;
- DWORD nRead;
- BYTE c;
-
- if(argc != 2)
- return FALSE;
-
- if((hFile = CreateFile((LPCTSTR)argv[1], GENERIC_READ, FILE_SHARE_READ,
- NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)) == INVALID_HANDLE_VALUE)
- {
- error_mess_str=argv[1];
- error_message(FILE_NOT_FOUND);
- return FALSE;
- }
- while(ReadFile(hFile, (LPVOID)&c, (DWORD)1, &nRead, 0) && (nRead == 1))
- {
- if(c == CTL_Z)
- break;
- printf("%c", c);
- }
- CloseHandle(hFile);
- printf("\n");
- return TRUE;
- }
-
-
-