|
|
1.1 root 1: /* 1.1.1.2 ! root 2: * Program to demonstrate DosFindFirst and DosMove. 1.1 root 3: * 1.1.1.2 ! root 4: * Compile as: cl -AL -G0 -Lp move.c ! 5: * ! 6: * Created by Microsoft Corp. 1987 1.1 root 7: */ 8: 1.1.1.2 ! root 9: #define INCL_DOSFILEMGR ! 10: ! 11: #include <os2def.h> ! 12: #include <bsedos.h> 1.1 root 13: #include <stdio.h> 14: #include <string.h> 15: 16: main (argc, argv) 17: int argc ; 18: char *argv [] ; 19: { 1.1.1.2 ! root 20: FILEFINDBUF findbuf ; ! 21: HDIR handle = 0xFFFF ; ! 22: UINT count = 1 ; 1.1 root 23: char oldpath [81], newpath [81], oldspec [81], newspec [81] ; 1.1.1.2 ! root 24: UINT code ; 1.1 root 25: char *ptr ; 26: 27: if (argc < 3) { 28: printf ("Syntax: MOVE filespec directory") ; 29: exit (1) ; 30: } 31: 32: strcpy (oldpath, strlwr (argv [1])) ; 33: 34: if (NULL != (ptr = strrchr (oldpath, '\\')) || 35: NULL != (ptr = strrchr (oldpath, ':'))) 36: *(ptr + 1) = '\0' ; 37: else 38: *oldpath = '\0' ; 39: 40: strcpy (newpath, strlwr (argv [2])) ; 41: 42: if (newpath [strlen (newpath) - 1] != '\\') 43: strcat (newpath, "\\") ; 44: 1.1.1.2 ! root 45: DosFindFirst (argv [1], &handle, 7, &findbuf, 1.1 root 46: sizeof (findbuf), &count, 0L) ; 47: 48: while(count) { 49: strcpy (oldspec, oldpath) ; 1.1.1.2 ! root 50: strcat (oldspec, findbuf.achName) ; 1.1 root 51: 52: strcpy (newspec, newpath) ; 1.1.1.2 ! root 53: strcat (newspec, findbuf.achName) ; 1.1 root 54: 1.1.1.2 ! root 55: code = DosMove (oldspec, newspec, 0L) ; 1.1 root 56: 57: printf ("%s --> %s %s\n", oldspec, newspec, 58: code ? "FAILED" : "") ; 59: 1.1.1.2 ! root 60: DosFindNext (handle, &findbuf, sizeof (findbuf), &count) ; 1.1 root 61: } 62: 1.1.1.2 ! root 63: DosFindClose (handle) ; 1.1 root 64: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.