diff options
author | Jakob Kaivo <jkk@ung.org> | 2022-03-04 12:32:20 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2022-03-04 12:32:20 -0500 |
commit | 55f277e77428d7423ae906a8e1f1324d35b07a7d (patch) | |
tree | 5c1c04703dff89c46b349025d2d3ec88ea9b3819 /fdate.c |
import Miranda 2.066 from upstream
Diffstat (limited to 'fdate.c')
-rw-r--r-- | fdate.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -0,0 +1,21 @@ +/* reads a filename from stdin and prints its time-last-modified, + in format [d]d <Month-name> yyyy */ + +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <time.h> + +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); +} |