util  Check-in [b4fe00021c]

Overview
Comment:make language more offensive
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b4fe00021ca3386461fea8bfef333236db209a67dfa0269b597edffc37c9abe6
User & Date: lexi on 2022-12-30 23:55:09
Other Links: manifest | tags
Context
2022-12-31
03:22
add rndcbytes and richascii spec; add notes to soda check-in: fc9b35c962 user: lexi tags: trunk
2022-12-30
23:55
make language more offensive check-in: b4fe00021c user: lexi tags: trunk
2022-12-26
13:31
add termcolors, update parvan and compose check-in: 54874eb3eb user: lexi tags: trunk
Changes

Modified bgrd.c from [d3537d80bd] to [882c831cca].

139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
...
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180

	// note ptys and pipes use basically the same
	// interface; you can use one as a drop-in
	// replacement for the other, tho the creation
	// function syntax is a bit different.

	if(fork()) goto master;
	      else goto child;

	master: {
		close(wr);
		char buf[256]; size_t sz;
		while(sz = read(rd, buf, 255)) {
			buf[sz]=0;
			for (size_t i=0;i<sz;++i) {
................................................................................
	}

	leave: {
		close(rd);
		return 0;
	}

	child: {
		close(rd);
		
		// redirect stdout (NOT stderr) to our pty master
		dup2(wr, 1);
		close(wr);

		execv(argv[1],argv+2);
		return 1; // THIS SHOULD NEVER HAPPEN
	}
}







|







 







|










139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
...
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180

	// note ptys and pipes use basically the same
	// interface; you can use one as a drop-in
	// replacement for the other, tho the creation
	// function syntax is a bit different.

	if(fork()) goto master;
	      else goto slave;

	master: {
		close(wr);
		char buf[256]; size_t sz;
		while(sz = read(rd, buf, 255)) {
			buf[sz]=0;
			for (size_t i=0;i<sz;++i) {
................................................................................
	}

	leave: {
		close(rd);
		return 0;
	}

	slave: {
		close(rd);
		
		// redirect stdout (NOT stderr) to our pty master
		dup2(wr, 1);
		close(wr);

		execv(argv[1],argv+2);
		return 1; // THIS SHOULD NEVER HAPPEN
	}
}