-
Notifications
You must be signed in to change notification settings - Fork 0
/
about.c
113 lines (92 loc) · 4.16 KB
/
about.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* about.c
* Copyright (C) 2017 M.J.Ahmadi <[email protected]>
*
* pjdate is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* pjdate is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _ABOUT_C
#define _ABOUT_C
#include <stdio.h>
#include <stdlib.h>
#include "about.h"
void print_version (void)
{
printf ("%s %s\n"
"Copyright (C) 2016.\n"
"This is free software; see the source for copying conditions."
"There is \nNO warranty; not even for MERCHANTABILITY or FITNESS"
"FOR A PARTICULAR PURPOSE.\n", PROGRAM_NAME, PROGRAM_VERSION);
printf ("Written by Mohammad Javad Ahmadi.\n");
exit(EXIT_SUCCESS);
}
void print_usage(FILE* stream, int exit_code)
{
if (exit_code == EXIT_SUCCESS) {
fprintf (stream, "Display persian date in jalali calendar command line tool.\n");
fprintf (stream, "Usage: %s [OPTION]... [+FORMAT]\n", PROGRAM_NAME);
} else {
fprintf (stream, "Try '%s --help' for more information.\n", PROGRAM_NAME);
}
if (exit_code == EXIT_SUCCESS) {
fprintf (stream,
" -f --format Formats output with the given pattern.\n"
" -j --to-jalali Converts given gregorian date to persian jalali date.\n"
" The format must be like this: 'YYYY-MM-DD'\n"
" -g --to-gregorian Converts given persian jalali date to gregorian date.\n"
" The format must be like this: 'YYYY-MM-DD'\n"
" -c --compare Will compare two different persian jalali date.\n"
" this option returns the bigger date.\n"
" The format must be like this: 'YYYY-MM-DD:YYYY-MM-DD'\n"
" -r --reference Display the last modification time of FILE in jalali date.\n"
/*TODO
" -d --difference Returns the number of days between two persian jalali date.\n"
" The format must be like this: 'YYYY-MM-DD:YYYY-MM-DD'\n"
*/
" --help Display this usage information and exit.\n"
" --version Output version information and exit.\n\n"
"FORMAT controls the output. Interpreted sequences are:\n"
" '%%a' locale's abbreviated weekday name.\n"
" '%%A' locale's full weekday name.\n"
" '%%B' locale's full month name.\n"
" '%%d' day of month (e.g., 14).\n"
" '%%D' day of month with leading zero (e.g., 05).\n"
" '%%m' month (1..12).\n"
" '%%M' month with leading zero (01..12).\n"
" '%%y' Two digit year with leading zero.\n"
" '%%Y' Four digit year.\n"
" '%%j' day of year (1..366).\n"
" '%%u' day of week (1..7).\n"
" '%%U' week number of year.\n\n"
"Examples:\n"
" To get current persian jalali date issue the following:\n\n"
" $ %s \n\n"
" To convert persian jalali date to gregorian date issue the following:\n\n"
" $ %s -g '1395-09-20'\n\n"
" To convert gregorian date to persian jalali date issue the following:\n\n"
" $ %s -j '2016-12-20'\n\n"
" To change the format of the output issue the following:\n\n"
" $ %s -f '%%y-%%m-%%d' \n\n"
" To get last modification date in persian jalali calendar issue the following:\n\n"
" $ %s -r '~/PATH/TO/FILE'\n\n", PROGRAM_NAME,
PROGRAM_NAME,
PROGRAM_NAME,
PROGRAM_NAME,
PROGRAM_NAME);
fprintf (stream, "Report bugs to [email protected]\n"
"Project home page: <https://github.com/mjahmadi/pjdate>\n\n");
}
exit(exit_code);
}
#endif /* _ABOUT_C */