Lines Matching +full:trim +full:- +full:data +full:- +full:valid
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
62 * imgp->args->begin_argv is the minimal successful exit requirement.
64 * If the given file is a shell-script, then the first line will start
66 * of the shell-interpreter to run, followed by zero or more tokens.
69 * arg[0] -> The name of interpreter as specified after `#!' in the
72 * arg[1] -> *If* there are any additional tokens on the first line,
77 * arg[x] -> the full pathname of the script. This will either be
80 * arg[x+1] -> all the arguments that were specified on the original
87 * HISTORICAL NOTE: From 1993 to mid-2005, FreeBSD parsed out the tokens as
101 const char *image_header = imgp->image_header; in exec_shell_imgact()
110 return (-1); in exec_shell_imgact()
114 * script. :-) in exec_shell_imgact()
116 if (imgp->interpreted & IMGACT_SHELL) in exec_shell_imgact()
119 imgp->interpreted |= IMGACT_SHELL; in exec_shell_imgact()
124 * valid -- the actual file might be much shorter than the page. in exec_shell_imgact()
127 error = VOP_GETATTR(imgp->vp, &vattr, imgp->proc->p_ucred); in exec_shell_imgact()
152 if (interpe - interpb >= MAXINTERP) in exec_shell_imgact()
156 * Find the beginning of the options (if any), and the end-of-line. in exec_shell_imgact()
157 * Then trim the trailing blanks off the value. Note that some in exec_shell_imgact()
158 * other operating systems do *not* trim the trailing whitespace... in exec_shell_imgact()
168 while (--ihp > optb && ((*ihp == ' ') || (*ihp == '\t'))) in exec_shell_imgact()
171 if (imgp->args->fname != NULL) { in exec_shell_imgact()
172 fname = imgp->args->fname; in exec_shell_imgact()
176 sbuf_printf(sname, "/dev/fd/%d", imgp->args->fd); in exec_shell_imgact()
189 offset = interpe - interpb + 1; /* interpreter */ in exec_shell_imgact()
191 offset += opte - optb + 1; in exec_shell_imgact()
193 length = (imgp->args->argc == 0) ? 0 : in exec_shell_imgact()
194 strlen(imgp->args->begin_argv) + 1; /* bytes to delete */ in exec_shell_imgact()
196 error = exec_args_adjust_args(imgp->args, length, offset); in exec_shell_imgact()
209 if (imgp->args->argc == 0) in exec_shell_imgact()
210 imgp->args->argc = 1; in exec_shell_imgact()
211 imgp->args->argc++; in exec_shell_imgact()
215 * the interpreter name and options-string. in exec_shell_imgact()
217 length = interpe - interpb; in exec_shell_imgact()
218 bcopy(interpb, imgp->args->begin_argv, length); in exec_shell_imgact()
219 *(imgp->args->begin_argv + length) = '\0'; in exec_shell_imgact()
222 length = opte - optb; in exec_shell_imgact()
223 bcopy(optb, imgp->args->begin_argv + offset, length); in exec_shell_imgact()
224 *(imgp->args->begin_argv + offset + length) = '\0'; in exec_shell_imgact()
226 imgp->args->argc++; in exec_shell_imgact()
231 * use and copy the interpreter's name to imgp->interpreter_name in exec_shell_imgact()
234 error = copystr(fname, imgp->args->begin_argv + offset, in exec_shell_imgact()
235 imgp->args->stringspace, NULL); in exec_shell_imgact()
238 imgp->interpreter_name = imgp->args->begin_argv; in exec_shell_imgact()