Subversion Repositories SvarDOS

Rev

Rev 501 | Rev 538 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 501 Rev 533
Line 128... Line 128...
128
  if (year == 0) return(-1);
128
  if (year == 0) return(-1);
129
  return(0);
129
  return(0);
130
}
130
}
131
 
131
 
132
 
132
 
133
static int cmd_date(struct cmd_funcparam *p) {
133
static enum cmd_result cmd_date(struct cmd_funcparam *p) {
134
  struct nls_patterns *nls = (void *)(p->BUFFER);
134
  struct nls_patterns *nls = (void *)(p->BUFFER);
135
  char *buff = p->BUFFER + sizeof(*nls);
135
  char *buff = p->BUFFER + sizeof(*nls);
136
  unsigned short i;
136
  unsigned short i;
137
  unsigned short year = 0;
137
  unsigned short year = 0;
138
  unsigned char mo, dy;
138
  unsigned char mo, dy;
Line 142... Line 142...
142
    outputnl("");
142
    outputnl("");
143
    outputnl("DATE [date]");
143
    outputnl("DATE [date]");
144
    outputnl("");
144
    outputnl("");
145
    outputnl("Type DATE with no parameters to display the current date and a prompt for a");
145
    outputnl("Type DATE with no parameters to display the current date and a prompt for a");
146
    outputnl("new one. Press ENTER to keep the same date.");
146
    outputnl("new one. Press ENTER to keep the same date.");
147
    return(-1);
147
    return(CMD_OK);
148
  }
148
  }
149
 
149
 
150
  i = nls_getpatterns(nls);
150
  i = nls_getpatterns(nls);
151
  if (i != 0) {
151
  if (i != 0) {
152
    outputnl(doserr(i));
152
    outputnl(doserr(i));
153
    return(-1);
153
    return(CMD_FAIL);
154
  }
154
  }
155
 
155
 
156
  /* display current date if no args */
156
  /* display current date if no args */
157
  if (p->argc == 0) {
157
  if (p->argc == 0) {
158
    /* get cur date */
158
    /* get cur date */
Line 220... Line 220...
220
    if (buff[1] == 0) break; /* empty string = no date change */
220
    if (buff[1] == 0) break; /* empty string = no date change */
221
    if ((cmd_date_parse(buff + 2, &year, &mo, &dy, nls) == 0) && (cmd_date_set(year, mo, dy) == 0)) break;
221
    if ((cmd_date_parse(buff + 2, &year, &mo, &dy, nls) == 0) && (cmd_date_set(year, mo, dy) == 0)) break;
222
    outputnl("Invalid date");
222
    outputnl("Invalid date");
223
  }
223
  }
224
 
224
 
225
  return(-1);
225
  return(CMD_OK);
226
}
226
}