MCPcopy Create free account
hub / github.com/gwsw/less / pipe_mark

Function pipe_mark

lsystem.c:252–280  ·  view source on GitHub ↗

* Pipe a section of the input file into the given shell command. * The section to be piped is the section "between" the current * position and the position marked by the given letter. * * If the mark is after the current screen, the section between * the top line displayed and the mark is piped. * If the mark is before the current screen, the section between * the mark and the bottom line d

(c, cmd)

Source from the content-addressed store, hash-verified

250 * the whole current screen is piped.
251 */
252 public int
253pipe_mark(c, cmd)
254 int c;
255 char *cmd;
256{
257 POSITION mpos, tpos, bpos;
258
259 /*
260 * mpos = the marked position.
261 * tpos = top of screen.
262 * bpos = bottom of screen.
263 */
264 mpos = markpos(c);
265 if (mpos == NULL_POSITION)
266 return (-1);
267 tpos = position(TOP);
268 if (tpos == NULL_POSITION)
269 tpos = ch_zero();
270 bpos = position(BOTTOM);
271
272 if (c == '.')
273 return (pipe_data(cmd, tpos, bpos));
274 else if (mpos <= tpos)
275 return (pipe_data(cmd, mpos, bpos));
276 else if (bpos == NULL_POSITION)
277 return (pipe_data(cmd, tpos, bpos));
278 else
279 return (pipe_data(cmd, tpos, mpos));
280}
281
282/*
283 * Create a pipe to the given shell command.

Callers 1

exec_mcaFunction · 0.85

Calls 3

markposFunction · 0.85
positionFunction · 0.85
pipe_dataFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…