coreutils

General Software Utilities
git clone http://git.omkov.net/coreutils
Log | Tree | Refs | README | LICENCE | Download

AuthorJamozed <[email protected]>
Date2020-07-06 11:43:24
Commita87087e83ee8abc661f815881c4b194c61454188
Parent601b288ba723e2500a54eec45ce5381e2c34dfac

time: Use libokv error reporting

Diffstat

M src/time.c | 14 +++++++-------

1 files changed, 7 insertions, 7 deletions

diff --git a/src/time.c b/src/time.c
index 83d281c..8dce209 100644
--- a/src/time.c
+++ b/src/time.c
@@ -1,4 +1,4 @@
-// time.c, version 1.0.0
+// time.c, version 1.0.1
 // OMKOV coreutils implementation of POSIX time
 // Copyright (C) 2020, Jakob Wakeling
 // All rights reserved.
@@ -33,9 +33,10 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 */
 
-#include "error.h"
 #include "optget.h"
 
+#include <error.h>
+
 #include <sys/times.h>
 #include <sys/wait.h>
 #include <unistd.h>
@@ -43,17 +44,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 #include <errno.h>
 #include <stdbool.h>
 #include <stdio.h>
-#include <string.h>
 #include <time.h>
 
-#define VERSION "1.0.0"
+#define VERSION "1.0.1"
 
 static bool pflag;
 
 static inline void help(void);
 static inline void version(void);
 
-int main(int ac, char *av[]) {
+int main(int ac, char *av[]) { A0 = av[0];
 	lop_t lops[] = {
 		{ "help",    ARG_NUL, 256 },
 		{ "version", ARG_NUL, 257 },
@@ -71,10 +71,10 @@ int main(int ac, char *av[]) {
 	struct tms tm; clock_t cl = times(&tm);
 
 	pid_t pid = fork();
-	if (pid == -1) { error(1, "%s: %s", av[0]); }
+	if (pid == -1) { error(1, "%s", serr()); }
 	else if (pid == 0) {
 		execvp(av[opt.ind], &av[opt.ind]);
-		warn("%s: %s: %s", av[0], av[opt.ind], serrno);
+		warn("%s: %s", av[opt.ind], serr());
 		return errno = ENOENT ? 127 : 126;
 	}