|
|
1.1 root 1: /* Copyright Bell Telephone Laboratories Whippany, N.J.
2:
3: * /////////////////////////////////////
4: * /////////////////////////////////////
5: * ////////////// bsys.c ///////////////
6: * /// J. P. Hawkins WH X4610 8C-001 ///
7: * ///// Fri Aug 24 17:26:01 1979 //////
8: * /////////////////////////////////////
9: * /////////////////////////////////////
10:
11: * Call system command from basic
12: *
13: */
14: /* "@(#) bsys.c: V 1.5 6/17/81" */
15: #include "bas.h"
16:
17: char shpath[] = "/bin/sh";
18: char shname[] = "sh";
19: extern char _string[];
20: bsys()
21: {
22: #ifdef RESTRICT
23: printf("RESTRICTED SHELL '!' NOT FUNCTIONAL\n");
24: return(-1);
25: #else
26: callsys(expr);
27: return(0);
28: #endif
29: }
30: /*
31: *
32: * SYSTEM CALL ROUTINE
33: */
34: callsys(string)
35: char string[];
36: {
37: int t,status;
38:
39: if((t = fork()) == 0)
40: if(execl(shpath,shname,"-c",string, 0) < 0)
41: {
42: error(inst.thing.linno, 31);
43: printf("%s NOT FOUND\n",string);
44: exit(0);
45: }
46: if(t == -1) abt("t == -1 from fork");
47: while(t != wait(&status)) ;
48: return 0;
49: }
50:
51: /*
52: *
53: * error abort
54: */
55: abt(s)
56: char *s;
57: {
58: printf("\nFailed to fork. %s\nReturn to interpreter\n", s);
59: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.