#include "tx.h" extern int ExpandNames(char *, char *, int); int ExpandAction(char *action,char **argum,char *notexpand,int limit) { int i ; char provis[128] ; if ( ! ExpandNames(provis,notexpand,limit) ) return 0; /* Exceeded limit */ /* To overcome limits to the size of the environment, we must execute the actions by a call to "command", with the /e option set to a sufficiently high value */ strcpy(action,getenv("COMSPEC")); strcat(action," /e:"); strcat(action,ch_env_size); /* size of the environment for child proc */ strcat(action," /c "); strcat(action,provis); /* The command line is now held in string "action". We must parse it to get the arguments. */ limit = MAX_ARGS ; for ( i = 0 ; i < MAX_ARGS ; i++ ) argum[i] = '\0' ; /* initialize with 0's the pointers */ i = 0 ; while ( *action ) { for (; *action == ' ' ; action++ ) ; /* skip spaces */ if ( *action ) { if ( !limit ) /* exceeded max number of args */ return 0; limit-- ; argum[i++]=action ; /* new argument */ /* What follows is a sleek way of putting a '\0' at the end of the substrings */ for ( ; *action && ( *action != ' ' || (*action++ = '\0')) ; action++ ) ; } } return i ; /* Return number of args on successful completion */ }