home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / dtx9202 / borhot / chpass.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-07  |  1.4 KB  |  46 lines

  1. /* ------------------------------------------------------ */
  2. /*                   CHPASS.C                             */
  3. /*                Child Process                           */
  4. /*  Must be compiled in a memory model which uses far     */
  5. /*  pointers by default, i.e., compact, large or huge.    */
  6. /* ------------------------------------------------------ */
  7.  
  8. #include <process.h>
  9. #include <string.h>
  10. #include <stdlib.h>
  11. #include <stdio.h>
  12. #include <dos.h>
  13.  
  14. #pragma warn -par     // we know argc is never used!
  15.  
  16. // ------------------------------------------------------- *
  17. int main(int argc, char **argv)
  18. {
  19.   char     *segment, *offset, *address;
  20.   unsigned seg, off, length;
  21.  
  22.   // extract the segment value from the string
  23.   segment = (char*) calloc(10,sizeof(unsigned));
  24.   length = (unsigned)(argv[1][0] - 48);
  25.   strcpy( segment, &argv[1][1]);
  26.   segment[length] = NULL;
  27.  
  28.   // extract the offset value from the string
  29.   offset = (char*) calloc(10,sizeof(unsigned));
  30.   strcpy(offset,&argv[1][length+1]);
  31.  
  32.   // convert from ascii to integer
  33.   seg = atoi(segment);
  34.   off = atoi(offset);
  35.  
  36.   // make pointer to parent data, and modify string
  37.   address = (char*) MK_FP(seg,off);
  38.   strcpy(address,"Child    modified");
  39.  
  40.   return 0;
  41. } // end of main()
  42. /* ------------------------------------------------------ */
  43. /*                    Ende von CHPASS.C                   */
  44.  
  45.  
  46.