From 55f277e77428d7423ae906a8e1f1324d35b07a7d Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Fri, 4 Mar 2022 12:32:20 -0500 Subject: import Miranda 2.066 from upstream --- fdate.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 fdate.c (limited to 'fdate.c') diff --git a/fdate.c b/fdate.c new file mode 100644 index 0000000..5a25803 --- /dev/null +++ b/fdate.c @@ -0,0 +1,21 @@ +/* reads a filename from stdin and prints its time-last-modified, + in format [d]d yyyy */ + +#include +#include +#include +#include +#include + +struct stat buf; +struct tm *t; + +char *month[] = {"January","February","March","April","May","June", + "July","August","September","October","November","December"}; +int main() +{ char f[200]; + if(scanf("%s",f)==1&&stat(f,&buf)==0) + t=localtime(&buf.st_mtime), + printf("%d %s %4d\n",(*t).tm_mday,month[(*t).tm_mon],(*t).tm_year+1900); + else fprintf(stderr,"fdate: bad file \"%s\"\n",f); +} -- cgit v1.2.1