static char *sccsid
= "@(#)dosys.c 4.10 (Berkeley) %G%";
register char *comstring
;
status
= doshell(comstring
,nohalt
);
else status
= doexec(comstring
);
metas(s
) /* Are there are any Shell meta-characters? */
while( (funny
[c
= *s
++] & META
) == 0 )
doshell(comstring
,nohalt
)
char *getenv(), *rindex();
char *shellcom
= getenv("SHELL");
if((waitpid
= vfork()) == 0)
if (shellcom
== 0) shellcom
= SHELLCOM
;
shellstr
= rindex(shellcom
, '/') + 1;
execl(shellcom
, shellstr
, (nohalt
? "-c" : "-ce"), comstring
, 0);
execl(SHELLCOM
, "sh", (nohalt
? "-c" : "-ce"), comstring
, 0);
fatal("Couldn't load Shell");
while( (pid
= wait(&status
)) != waitpid
)
* Close open directory files before exec'ing
register struct dirhdr
*od
;
for (od
= firstod
; od
; od
= od
->nxtopendir
)
* we cannot call closedir since this will modify
* the parents data space; just call close directly.
while( *str
==' ' || *str
=='\t' )
return(-1); /* no command */
fatal1("%s: Too many arguments.", str
);
while(*t
!=' ' && *t
!='\t' && *t
!='\0')
for( *t
++ = '\0' ; *t
==' ' || *t
=='\t' ; ++t
)
if((waitpid
= vfork()) == 0)
fatal1("Cannot load %s",str
);
if( stat(name
,&stbuff
) < 0)
fprintf(stderr
, "touch: file %s does not exist.\n", name
);
if( (fd
= open(name
, 2)) < 0)
if( read(fd
, junk
, 1) < 1)
if( write(fd
, junk
, 1) < 1 )
fprintf(stderr
, "Cannot touch %s\n", name
);
if( (fd
= creat(name
, 0666)) < 0)