time.c (3f330d7d1a3fe98c53faf01d0f30c0a9fbb37c41) | time.c (d6c762af4072e4216e6a0e5c32c7d7f28038a9c1) |
---|---|
1/* 2 * Copyright (c) 1987, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 108 unchanged lines hidden (view full) --- 117 } 118 119 gettimeofday(&before, (struct timezone *)NULL); 120 switch(pid = fork()) { 121 case -1: /* error */ 122 err(1, "time"); 123 /* NOTREACHED */ 124 case 0: /* child */ | 1/* 2 * Copyright (c) 1987, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 108 unchanged lines hidden (view full) --- 117 } 118 119 gettimeofday(&before, (struct timezone *)NULL); 120 switch(pid = fork()) { 121 case -1: /* error */ 122 err(1, "time"); 123 /* NOTREACHED */ 124 case 0: /* child */ |
125 errno = 0; | |
126 execvp(*argv, argv); | 125 execvp(*argv, argv); |
127 warn("%s", *argv); 128 if (errno == ENOENT) 129 _exit(127); /* POSIX: utility could not be found */ 130 else 131 _exit(126); /* POSIX: utility could not be invoked */ | 126 err(errno == ENOENT ? 127 : 126, "%s", *argv); |
132 /* NOTREACHED */ 133 } 134 /* parent */ 135 (void)signal(SIGINT, SIG_IGN); 136 (void)signal(SIGQUIT, SIG_IGN); 137 while (wait3(&status, 0, &ru) != pid); /* XXX use waitpid */ 138 gettimeofday(&after, (struct timezone *)NULL); 139 if ( ! WIFEXITED(status)) --- 139 unchanged lines hidden --- | 127 /* NOTREACHED */ 128 } 129 /* parent */ 130 (void)signal(SIGINT, SIG_IGN); 131 (void)signal(SIGQUIT, SIG_IGN); 132 while (wait3(&status, 0, &ru) != pid); /* XXX use waitpid */ 133 gettimeofday(&after, (struct timezone *)NULL); 134 if ( ! WIFEXITED(status)) --- 139 unchanged lines hidden --- |