#include <xinu.h>
#include <string.h>
#include <stdio.h>
Go to the source code of this file.
◆ xsh_date()
shellcmd xsh_date |
( |
int |
nargs, |
|
|
char * |
args[] |
|
) |
| |
Definition at line 11 of file xsh_date.c.
References ascdate(), Date, DATE_DST_AUTO, DATE_DST_OFF, DATE_DST_ON, dateinfo::dt_bootvalid, dateinfo::dt_daylight, FALSE, fprintf(), gettime(), printf(), stderr, strncmp(), and SYSERR.
19 if (nargs == 2 &&
strncmp(args[1],
"--help", 7) == 0) {
20 printf(
"Usage: %s\n\n", args[0]);
22 printf(
"\tDisplays the current date and time\n");
23 printf(
"Options (one per invocation):\n");
24 printf(
"\t-f\tforce a time server request to be sent\n");
25 printf(
"\t-d\tset daylight savings time on\n");
26 printf(
"\t-s\tset standard time (not daylight savings)\n");
27 printf(
"\t-a\tset daylight savings to automatic\n");
28 printf(
"\t--help\tdisplay this help and exit\n");
42 if (
strncmp(args[1],
"-f", 3) == 0) {
44 }
else if (
strncmp(args[1],
"-d", 3) == 0) {
46 }
else if (
strncmp(args[1],
"-s", 3) == 0) {
48 }
else if (
strncmp(args[1],
"-a", 3) == 0) {
53 "Try '%s --help' for more information\n",
62 "%s: could not obtain the current date\n",
int32 strncmp(const char *, const char *, int32)
int32 printf(const char *,...)
#define FALSE
Boolean False(0)
int int32
符号あり32ビット整数(int)
int32 fprintf(int, char *,...)
status ascdate(uint32, char *)
unsigned int uint32
符号なし32ビット整数(unsigned int)
status gettime(uint32 *)
1970年1月1日からの経過時間(秒単位)にロケーション(時差)を反映した時間を返す。