apply.c (216370) | apply.c (245048) |
---|---|
1/*- 2 * Copyright (c) 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Jan-Simon Pendry. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 23 unchanged lines hidden (view full) --- 32 33#if 0 34#ifndef lint 35static char sccsid[] = "@(#)apply.c 8.4 (Berkeley) 4/4/94"; 36#endif 37#endif 38 39#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Jan-Simon Pendry. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 23 unchanged lines hidden (view full) --- 32 33#if 0 34#ifndef lint 35static char sccsid[] = "@(#)apply.c 8.4 (Berkeley) 4/4/94"; 36#endif 37#endif 38 39#include <sys/cdefs.h> |
40__FBSDID("$FreeBSD: head/usr.bin/apply/apply.c 216370 2010-12-11 08:32:16Z joel $"); | 40__FBSDID("$FreeBSD: head/usr.bin/apply/apply.c 245048 2013-01-04 23:44:22Z delphij $"); |
41 42#include <sys/types.h> 43#include <sys/sbuf.h> 44#include <sys/wait.h> 45 46#include <ctype.h> 47#include <err.h> 48#include <errno.h> 49#include <paths.h> 50#include <signal.h> 51#include <stdio.h> 52#include <stdlib.h> 53#include <string.h> 54#include <unistd.h> 55 56#define EXEC "exec " 57 | 41 42#include <sys/types.h> 43#include <sys/sbuf.h> 44#include <sys/wait.h> 45 46#include <ctype.h> 47#include <err.h> 48#include <errno.h> 49#include <paths.h> 50#include <signal.h> 51#include <stdio.h> 52#include <stdlib.h> 53#include <string.h> 54#include <unistd.h> 55 56#define EXEC "exec " 57 |
58static int exec_shell(const char *, char *, char *); | 58static int exec_shell(const char *, const char *, const char *); |
59static void usage(void); 60 61int 62main(int argc, char *argv[]) 63{ 64 struct sbuf *cmdbuf; 65 long arg_max; 66 int ch, debug, i, magic, n, nargs, offset, rval; --- 150 unchanged lines hidden (view full) --- 217} 218 219/* 220 * exec_shell -- 221 * Execute a shell command using passed use_shell and use_name 222 * arguments. 223 */ 224static int | 59static void usage(void); 60 61int 62main(int argc, char *argv[]) 63{ 64 struct sbuf *cmdbuf; 65 long arg_max; 66 int ch, debug, i, magic, n, nargs, offset, rval; --- 150 unchanged lines hidden (view full) --- 217} 218 219/* 220 * exec_shell -- 221 * Execute a shell command using passed use_shell and use_name 222 * arguments. 223 */ 224static int |
225exec_shell(const char *command, char *use_shell, char *use_name) | 225exec_shell(const char *command, const char *use_shell, const char *use_name) |
226{ 227 pid_t pid; 228 int omask, pstat; 229 sig_t intsave, quitsave; 230 231 if (!command) /* just checking... */ 232 return(1); 233 --- 11 unchanged lines hidden (view full) --- 245 quitsave = signal(SIGQUIT, SIG_IGN); 246 pid = waitpid(pid, &pstat, 0); 247 (void)sigsetmask(omask); 248 (void)signal(SIGINT, intsave); 249 (void)signal(SIGQUIT, quitsave); 250 return(pid == -1 ? -1 : pstat); 251} 252 | 226{ 227 pid_t pid; 228 int omask, pstat; 229 sig_t intsave, quitsave; 230 231 if (!command) /* just checking... */ 232 return(1); 233 --- 11 unchanged lines hidden (view full) --- 245 quitsave = signal(SIGQUIT, SIG_IGN); 246 pid = waitpid(pid, &pstat, 0); 247 (void)sigsetmask(omask); 248 (void)signal(SIGINT, intsave); 249 (void)signal(SIGQUIT, quitsave); 250 return(pid == -1 ? -1 : pstat); 251} 252 |
253void | 253static void |
254usage(void) 255{ 256 257 (void)fprintf(stderr, 258 "usage: apply [-a magic] [-d] [-0123456789] command arguments ...\n"); 259 exit(1); 260} | 254usage(void) 255{ 256 257 (void)fprintf(stderr, 258 "usage: apply [-a magic] [-d] [-0123456789] command arguments ...\n"); 259 exit(1); 260} |