home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / k95source / stub.c < prev    next >
C/C++ Source or Header  |  2020-01-01  |  891b  |  38 lines

  1. /* F O O . C  --  Stub for Kermit 95 */
  2. /*
  3.   Authors: Frank da Cruz (fdc@columbia.edu)
  4.            Jeffrey Altman (jaltman@columbia.edu),
  5.   Columbia University Academic Information Systems, New York City.
  6.  
  7.   Copyright (C) 1995-2003, Trustees of Columbia University in the City of
  8.   New York.  All rights reserved.
  9. */
  10. #include <windows.h>
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <string.h>
  14. #include <process.h>
  15.  
  16. char k95path[512];
  17.  
  18. int
  19. main( int argc, const char **argv ) {
  20.     char *p;
  21.     int i;
  22.  
  23.     GetModuleFileName(NULL, k95path, 512);
  24.     p = k95path + strlen(k95path);
  25.     while ( *p != '\\' && p > k95path ) p--;
  26.     if ( p != k95path ) 
  27.         p++;
  28.     strcpy(p,"k95.exe");
  29.  
  30.     p = (char *)(argv[0] + strlen(argv[0]));
  31.     while ( *p != '\\' && p > argv[0] ) p--;
  32.     if ( p != argv[0] ) 
  33.         p++;
  34.     argv[0] = (const char *)p;
  35.  
  36.     return spawnv( _P_WAIT, k95path, argv ) ;
  37. }
  38.