added mtime, next version will be 5 - 9base - revived minimalist port of Plan 9… | |
git clone git://git.suckless.org/9base | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 07cf44e6452f7928fe20cc2849c249b28d19344f | |
parent 244b935e44cbdc4d361135bf83c083688b943eb4 | |
Author: [email protected] <unknown> | |
Date: Mon, 22 Mar 2010 08:04:31 +0000 | |
added mtime, next version will be 5 | |
Diffstat: | |
M Makefile | 2 +- | |
M config.mk | 6 +++--- | |
A mtime/Makefile | 11 +++++++++++ | |
A mtime/mtime | 0 | |
A mtime/mtime.c | 33 +++++++++++++++++++++++++++++… | |
5 files changed, 48 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/Makefile b/Makefile | |
@@ -3,7 +3,7 @@ | |
include config.mk | |
SUBDIRS = lib9 yacc awk basename bc cal cat cleanname date dc du echo grep ho… | |
- mk rc read sed seq sleep sort tee test touch tr troff uniq | |
+ mk mtime rc read sed seq sleep sort tee test touch tr troff uniq | |
all: | |
@echo 9base build options: | |
diff --git a/config.mk b/config.mk | |
@@ -4,10 +4,10 @@ | |
PREFIX = /usr/local/plan9 | |
MANPREFIX = ${PREFIX}/share/man | |
-VERSION = 4 | |
-#OBJTYPE = 386 | |
+VERSION = 5 | |
+OBJTYPE = 386 | |
#OBJTYPE = arm | |
-OBJTYPE = x86_64 | |
+#OBJTYPE = x86_64 | |
# Linux/BSD | |
#CFLAGS += -Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -c -I. … | |
diff --git a/mtime/Makefile b/mtime/Makefile | |
@@ -0,0 +1,11 @@ | |
+# mtime - unix port from plan9 | |
+# | |
+# Depends on ../lib9 | |
+ | |
+TARG = mtime | |
+ | |
+include ../std.mk | |
+ | |
+pre-uninstall: | |
+ | |
+post-install: | |
diff --git a/mtime/mtime b/mtime/mtime | |
Binary files differ. | |
diff --git a/mtime/mtime.c b/mtime/mtime.c | |
@@ -0,0 +1,33 @@ | |
+#include <u.h> | |
+#include <libc.h> | |
+ | |
+void | |
+usage(void) | |
+{ | |
+ fprint(2, "usage: mtime file...\n"); | |
+ exits("usage"); | |
+} | |
+ | |
+void | |
+main(int argc, char **argv) | |
+{ | |
+ int errors, i; | |
+ Dir *d; | |
+ | |
+ ARGBEGIN{ | |
+ default: | |
+ usage(); | |
+ }ARGEND | |
+ | |
+ errors = 0; | |
+ for(i=0; i<argc; i++){ | |
+ if((d = dirstat(argv[i])) == nil){ | |
+ fprint(2, "stat %s: %r\n", argv[i]); | |
+ errors = 1; | |
+ }else{ | |
+ print("%11lud %s\n", d->mtime, argv[i]); | |
+ free(d); | |
+ } | |
+ } | |
+ exits(errors ? "errors" : nil); | |
+} |