summaryrefslogtreecommitdiff
path: root/v4.0/src/CMD/RESTORE/RESTPARS.C
diff options
context:
space:
mode:
Diffstat (limited to 'v4.0/src/CMD/RESTORE/RESTPARS.C')
-rw-r--r--v4.0/src/CMD/RESTORE/RESTPARS.C1002
1 files changed, 1002 insertions, 0 deletions
diff --git a/v4.0/src/CMD/RESTORE/RESTPARS.C b/v4.0/src/CMD/RESTORE/RESTPARS.C
new file mode 100644
index 0000000..6299f75
--- /dev/null
+++ b/v4.0/src/CMD/RESTORE/RESTPARS.C
@@ -0,0 +1,1002 @@
1
2/*-------------------------------
3/* SOURCE FILE NAME: restpars.c
4/*-------------------------------
5/*  0 */
6#include "rt.h"
7#include "rt1.h"
8#include "rt2.h"
9#include "restpars.h" /*;AN000;4*/
10#include "direct.h"
11#include "string.h"
12#include "ctype.h"
13#include "dos.h" /*;AN000;2*/
14#include "comsub.h" /* common subroutine def'n */
15#include "doscalls.h"
16#include "error.h"
17
18/*=============================*/
19extern BYTE srcd; /*;AN000;4*/
20extern BYTE destd; /*;AN000;4*/
21extern BYTE inpath [MAXPATH]; /*;AN000;*/
22extern BYTE infname [MAXFNAME]; /*;AN000;*/
23extern BYTE infext [MAXFEXT]; /*;AN000;*/
24extern BYTE infspec [MAXFSPEC]; /*;AN000;*/
25/*=============================*/
26
27extern BYTE destddir[MAXPATH+3];
28extern BYTE srcddir[MAXPATH+3];
29extern BYTE rtswitch;
30extern BYTE control_flag;
31extern BYTE control_flag2;
32extern BYTE filename[12];
33extern unsigned control_file_handle; /* !wrw */
34extern struct subst_list sublist; /*;AN000;6Message substitution list */
35
36struct p_parms parms; /*;AN000;4 Parser data structure */
37struct p_parmsx parmsx; /*;AN000;4 Parser data structure */
38struct p_pos_blk pos1; /*;AN000;4 Parser data structure */
39struct p_pos_blk pos2; /*;AN000;4 Parser data structure */
40struct p_sw_blk sw1; /*;AN000;4 /S /P /M /N data structure */
41struct p_sw_blk sw2; /*;AN000;4 /E: /L: parser data structure */
42struct p_sw_blk sw3; /*;AN000;4 /B: /A: parser data structure */
43struct p_result_blk pos_buff; /*;AN000;4 Parser data structure */
44struct switchbuff sw_buff; /*;AN000;4 Parser data structure */
45struct timebuff time_buff; /*;AN000;4 Parser data structure */
46struct datebuff date_buff; /*;AN000;4 Parser data structure */
47DWORD noval; /*;AN000;4 Value list for PARSER */
48int parse_count = 1; /*;AN000;4*//*;AC002;*/
49char curr_parm[128]; /*;AN004; Current parameter being parsed*/
50extern struct timedate td;
51
52/* ************************************************/
53/*
54/* SUBROUTINE NAME: parse_command_line
55/*
56/* FUNCTION:
57/*
58/* Parse the RESTORE command line
59/*
60/**************************************************/
61void parse_command_line(argc,argv) /*;AN000;4 */
62int argc; /*;AN000;4 */
63char *argv[]; /*;AN000;4 */
64{ /*;AN000;4 */
65#define EOL -1 /*;AN000;4 */
66 union REGS inregs, outregs; /*;AN000;4 */
67 char cmd_line[128]; /*;AN000;4 */
68 char not_finished = TTRUE; /*;AN000;4 */
69 int x; /*;AN000;4 */
70
71
72 /* Copy command line parameters to local area */
73 cmd_line[0] = NUL; /*;AN000;4*/
74 for (x=1; x<=argc; x++) /*;AN000;4*/
75 { /*;AN000;4*/
76 strcat(cmd_line,argv[x]); /*;AN000;4*/
77 if (x!=argc) strcat(cmd_line," "); /*;AN000;4*/
78 } /*;AN000;4*/
79
80 strcat(cmd_line,"\r"); /* Add CR, LF */ /*;AN004;*/
81
82 if (argc-1 < 1) /*;AN000;4*/
83 { /*;AC000;4*/
84 display_it(NO_SOURCE,STND_ERR_DEV,0,NO_RESPTYPE,(BYTE)UTIL_MSG);/*;AN000;6*/
85 usererror(INVALIDPARM); /*;AC000;4*/
86 } /*;AC000;4*/
87
88 if (argc-1 < 2) /*;AN000;4*/
89 { /*;AC000;4*/
90 display_it(NO_TARGET,STND_ERR_DEV,0,NO_RESPTYPE,(BYTE)UTIL_MSG);/*;AN000;6*/
91 usererror(INVALIDPARM); /*;AC000;4*/
92 } /*;AC000;4*/
93
94 /* Check for same source and target drive */
95 if (com_toupper(*argv[1]) == com_toupper(*argv[2]) /*;AN000;4*/
96 && (BYTE)*(argv[1]+1) == ':' /*;AN000;4*/
97 && (BYTE)*(argv[1]+2) == NUL /*;AN000;4*/
98 && (BYTE)*(argv[2]+1) == ':' /*;AN000;4*/
99 ) /*;AN000;4*/
100 { /*;AC000;4*/
101 display_it(SOURCE_TARGET_SAME,STND_ERR_DEV,0,NO_RESPTYPE,(BYTE)UTIL_MSG);/*;AN000;6*/
102 usererror(INVALIDPARM); /*;AC000;4*/
103 } /*;AC000;4*/
104
105 /* Initialize parser data structures */
106 parse_init(); /*;AN000;4*/
107
108 inregs.x.si = (WORD)&cmd_line[0]; /*DS:SI*/ /*;AN000;4 make DS:SI point to source */
109 inregs.x.cx = 0; /*;AN000;4*/
110
111 /*********************/
112 /* PARSE LOOP !!!!!! */
113 /*********************/
114 while (not_finished) /*;AN000;4 For all strings in command line */
115 { /*;AN000;4 */
116 inregs.x.dx = 0; /*;AN000;4 RESERVED */
117 inregs.x.di = (WORD)&parms; /*ES:DI*/ /*;AN000;4 address of parm list */
118 parse(&inregs,&outregs); /*;AN000;4 Call DOS PARSE service routines*/
119
120 x=0; /* Save the parsed parameter */ /*;AN004;*/
121 for (inregs.x.si; inregs.x.si<outregs.x.si; inregs.x.si++) /*;AN004;*/
122 { /*;AN004;*/
123 curr_parm[x] = *(char *)inregs.x.si; /*;AN004;*/
124 x++; /*;AN004;*/
125 } /*;AN004;*/
126
127 curr_parm[x] = NUL; /*;AN004;*/
128
129 inregs = outregs; /* Reset registers */ /*;AN000;4 Reset registers*/
130
131 /* Check for PARSE ERROR*/
132 if (outregs.x.ax != (WORD)NOERROR) /*;AN000;4*/
133 { /*;AN000;4*/
134 if (outregs.x.ax==(WORD)EOL) /* Was it End of line? */ /*;AN000;4*/
135 not_finished = FFALSE; /*;AN000;4*/
136 else
137 { /* It was an error */ /*;AN000;4*/
138 not_finished = FFALSE; /*;AN000;4*/
139 parse_error(outregs.x.ax,(BYTE)PARSEERR); /*;AN000;4*//*;AC002;*/
140 } /*;AN000;4*/
141 } /*;AN000;4*/
142
143 if (not_finished) /* Parse was successful !*/ /*;AN000;4*/
144 { /*;AN000;4*/
145 if ( outregs.x.dx == (WORD)&time_buff || /*;AN000;4*/
146 outregs.x.dx == (WORD)&date_buff || /*;AN000;4*/
147 outregs.x.dx == (WORD)&sw_buff /*;AN000;4*/
148 ) /*;AN000;4*/
149 process_switch(outregs.x.dx,argv[parse_count]); /*;AN000;4*//*;AC002;*/
150 } /*;AN000;4*/
151
152 parse_count++; /*;AN000;4*//*;AC002;*/
153 } /* End WHILE Parse loop */ /*;AN000;4*/
154
155 /* Check source and target filespec */
156 if (strlen(argv[2]) >= 5) /*;AN000;p2591*/
157 check_for_device_names(argv); /*;AN000;p2591*/
158
159 check_source_drive(argc,argv); /*;AN000;4*/
160 check_target_filespec(argc,argv); /*;AN000;4*/
161
162 return; /*;AN000;4*/
163} /* end parser */ /*;AN000;4*/
164
165/** ***********************************************/
166/*
167/* SUBROUTINE NAME: parse_error
168/*
169/* FUNCTION:
170/*
171/* There was a parse error. Display message and die
172/*
173/**************************************************/
174void parse_error(msg_num,class) /*;AN000;4*//*;AC002;*/
175WORD msg_num; /*;AN000;4*/
176BYTE class; /*;AN000;4*/
177{ /*;AN000;4*/
178 sublist.value1 = &curr_parm[0]; /*;AN002;*/
179 sublist.flags1 = LEFT_ALIGN + CHAR_FIELD_ASCIIZ; /*;AN002;*/
180 sublist.one = 0; /*;AN002;*/
181 sublist.max_width1 = (BYTE)strlen(curr_parm); /*;AN002;*/
182 sublist.min_width1 = sublist.max_width1; /*;AN002;*/
183
184
185 if (msg_num == NO_SOURCE || msg_num == NO_TARGET) /*;AN000;6*/
186 display_it(msg_num,STND_ERR_DEV,0,NO_RESPTYPE,class); /*;AN000;6*/
187 else /*;AN000;6*/
188 display_it(msg_num,STND_ERR_DEV,1,NO_RESPTYPE,class); /*;AN000;6*/
189
190
191 usererror(INVALIDPARM); /*;AN000;4*//*;AC002;*/
192 return; /*;AN000;4*/
193} /*;AN000;4*/
194
195/** ***********************************************/
196/*
197/* SUBROUTINE NAME: check_date
198/*
199/* FUNCTION:
200/*
201/* A date parameter was entered. Validate it
202/*
203/**************************************************/
204void check_date(year,month,day) /*;AN000;4*//*;AC002;*/
205WORD year; /*;AN000;4*/
206BYTE month; /*;AN000;4*/
207BYTE day; /*;AN000;4*/
208{ /*;AN000;4*/
209 if (year > 2099 || year < 1980) /*;AC000;4*/
210 parse_error(INV_DATE,(BYTE)UTILMSG); /*;AC000;4*//*;AC002;*/
211
212 if (month > 12 || month < 1) /*;AC000;4*/
213 parse_error(INV_DATE,(BYTE)UTILMSG); /*;AC000;4*//*;AC002;*/
214
215 if (day > 31 || month < 1) /*;AC000;4*/
216 parse_error(INV_DATE,(BYTE)UTILMSG); /*;AC000;4*//*;AC002;*/
217
218 /* Verify day not greater then 30 if Apr,Jun,Sep,Nov */
219 if ((day>30) && (month==4 || month==6 || month==9 || month==11)) /*;AC000;4*/
220 parse_error(INV_DATE,(BYTE)UTILMSG); /*;AC000;4*//*;AC002;*/
221
222 if (month == 2) /* Deal with February */ /*;AC000;4*/
223 { /*;AC000;4*/
224 if (day > 29) /* if Feb 30 or above */ /*;AC000;4*/
225 parse_error(INV_DATE,(BYTE)UTILMSG); /*;AC000;4*//*;AC002;*/
226
227 if ((year % 4) != 0) /* If not a leap year */ /*;AC000;4*/
228 if (day > 28) /* if Feb 29 or above */ /*;AC000;4*/
229 parse_error(INV_DATE,(BYTE)UTILMSG); /*;AC000;4*//*;AC002;*/
230 } /*;AC000;4*/
231
232 return; /*;AN000;4*/
233} /*;AN000;4*/
234/** ***********************************************/
235/*
236/* SUBROUTINE NAME: check_time
237/*
238/* FUNCTION:
239/*
240/* A time parameter was entered. Validate it
241/*
242/**************************************************/
243void check_time(hours,minutes,seconds,hundreds) /*;AN000;4*//*;AC002;*/
244BYTE hours; /*;AN000;4*/
245BYTE minutes; /*;AN000;4*/
246BYTE seconds; /*;AN000;4*/
247BYTE hundreds; /*;AN000;4*/
248{ /*;AN000;4*/
249
250 if (hours > 23 || hours < 0) /*;AC000;4*/
251 parse_error(INV_TIME,(BYTE)UTILMSG); /*;AC000;4*//*;AC002;*/
252
253 if (minutes >= 60 || minutes < 0) /*;AC000;4*/
254 parse_error(INV_TIME,(BYTE)UTILMSG); /*;AC000;4*//*;AC002;*/
255
256 if (seconds >= 60 || seconds < 0) /*;AC000;4*/
257 parse_error(INV_TIME,(BYTE)UTILMSG); /*;AC000;4*//*;AC002;*/
258
259 return; /*;AN000;4*/
260} /*;AN000;4*/
261
262/** ***********************************************/
263/*
264/* SUBROUTINE NAME: parse_init
265/*
266/* FUNCTION:
267/*
268/* Initialize the parser data structures
269/*
270/**************************************************/
271#define SSTRING 0x2000 /*;AN000;4*/
272#define FILESPEC 0x0200 /*;AN000;4 */
273#define CAP_FILETABLE 0x0001 /*;AN000;4 */
274#define DRIVELETTER 0x100; /*;AN000;4 */
275#define DATESTRING 0x1000 /*;AN000;4 */
276#define TIMESTRING 0x0800 /*;AN000;4 */
277
278void parse_init() /*;AN000;4 */
279
280{ /* Initialize PARMS data structure */ /*;AN000;4 */
281 parms.parmsx_ptr = (WORD)&parmsx; /*;AN000;4 */
282 parms.p_num_extra = 1; /*;AN000;4 */
283 parms.p_len_extra_delim = 1; /*;AN000;4 */
284 parms.p_extra_delim[0] = ';'; /*;AN000;4 */
285 parms.p_extra_delim[1] = NUL; /*;AN000;4 */
286
287 /* Initialize PARMSX data structure */
288 parmsx.p_minpos= 2; /*;AN000;4 */
289 parmsx.p_maxpos= 2; /*;AN000;4 */
290 parmsx.pos1_ptr= (WORD)&pos1; /*;AN000;4 */
291 parmsx.pos2_ptr= (WORD)&pos2; /*;AN000;4 */
292 parmsx.num_sw = 3; /*;AN000;4 */
293 parmsx.sw1_ptr = (WORD)&sw1; /*;AN000;4 */
294 parmsx.sw2_ptr = (WORD)&sw2; /*;AN000;4 */
295 parmsx.sw3_ptr = (WORD)&sw3; /*;AN000;4 */
296 parmsx.num_keywords = 0; /*;AN000;4 */
297
298 /* Initialize POS1 (Source Drive) data structure */
299 pos1.match_flag = FILESPEC; /*;AN000;4 */
300 pos1.function_flag = 0; /*;AN000;4 */
301 pos1.result_buf = (WORD)&pos_buff; /*;AN000;4 */
302 pos1.value_list = (WORD)&noval; /*;AN000;4 */
303 pos1.nid = 0; /*;AN000;4 */
304
305 /* Initialize POS2 (Target FILESPEC) data structure */
306 pos2.match_flag = SSTRING; /*;AN000;4 */
307 pos2.function_flag = 0; /*;AN000;4 */
308 pos2.result_buf = (WORD)&pos_buff; /*;AN000;4 */
309 pos2.value_list = (WORD)&noval; /*;AN000;4 */
310 pos2.nid = 0; /*;AN000;4 */
311
312 /* Initialize SW1 data structure */
313 sw1.p_match_flag = DATESTRING; /*;AN000;4 */
314 sw1.p_function_flag = 0; /*;AN000;4 */
315 sw1.p_result_buf = (WORD)&date_buff; /*;AN000;4 */
316 sw1.p_value_list = (WORD)&noval; /*;AN000;4 */
317 sw1.p_nid = 2; /*;AN000;4 */
318 strcpy(sw1.switch1,"/B"); /*;AN000;4 */
319 strcpy(sw1.switch2,"/A"); /*;AN000;4 */
320
321 /* Initialize SW2 data structure */
322 sw2.p_match_flag = TIMESTRING; /*;AN000;4 */
323 sw2.p_function_flag = 0; /*;AN000;4 */
324 sw2.p_result_buf = (WORD)&time_buff; /*;AN000;4 */
325 sw2.p_value_list = (WORD)&noval; /*;AN000;4 */
326 sw2.p_nid = 2; /*;AN000;4 */
327 strcpy(sw2.switch1,"/E"); /*;AN000;4 */
328 strcpy(sw2.switch2,"/L"); /*;AN000;4 */
329
330
331 /* Initialize SW3 data structure */
332 sw3.p_match_flag = 0; /*;AN000;4 */
333 sw3.p_function_flag = 0; /*;AN000;4 */
334 sw3.p_result_buf = (WORD)&sw_buff; /*;AN000;4 */
335 sw3.p_value_list = (WORD)&noval; /*;AN000;4 */
336 sw3.p_nid = 4; /*;AN000;4 */
337 strcpy(sw3.switch1,"/S"); /*;AN000;4 */
338 strcpy(sw3.switch2,"/P"); /*;AN000;4 */
339 strcpy(sw3.switch3,"/M"); /*;AN000;4 */
340 strcpy(sw3.switch4,"/N"); /*;AN000;4 */
341
342 /*********************************************/
343 /* Also initialize all time and date values */
344 /*********************************************/
345 td.earlier_hour = 0;
346 td.earlier_minute = 0;
347 td.earlier_second = 0;
348 td.later_hour = 0;
349 td.later_minute = 0;
350 td.later_second = 0;
351 td.before_year = 0;
352 td.before_month = 0;
353 td.before_day = 0;
354 td.after_year = 0;
355 td.after_month = 0;
356 td.after_day = 0;
357
358 /**************************************************/
359 /* Also initialize the message substitution list */
360 /**************************************************/
361 sublist.sl_size1= SUBLIST_SIZE; /*;AN000;6*/
362 sublist.sl_size2= SUBLIST_SIZE; /*;AN000;6*/
363 sublist.one = 1; /*;AN000;6*/
364 sublist.two = 2; /*;AN000;6*/
365 sublist.zero1 = 0; /*;AN000;6*/
366 sublist.zero2 = 0; /*;AN000;6*/
367 sublist.pad_char1 = ' '; /*;AN000;6*/
368 sublist.pad_char2 = ' '; /*;AN000;6*/
369
370 return; /*;AN000;4 */
371} /*;AN000;4 */
372
373
374/** ***********************************************/
375/*
376/* SUBROUTINE NAME: check_for_device_names
377/*
378/* FUNCTION:
379/*
380/* Make sure user not trying to restore a reserved device name
381/*
382/**************************************************/
383void check_for_device_names(argv) /*;AN000;p2591*/
384char *argv[]; /*;AN000;p2591*/
385{ /*;AN000;p2591*/
386 union REGS qregs; /*;AN000;p2591*/
387 char target[128]; /*;AN000;p2591*/
388 char *t; /*;AN000;p2591*/
389
390#define CAPITALIZE_STRING 0x6521 /*;AN000;p2591*/
391
392 qregs.x.ax = CAPITALIZE_STRING; /*;AN000;p2591*/
393 qregs.x.dx = (WORD)argv[2]; /*;AN000;p2591*/
394 strcpy(target,argv[2]); /*;AN000;p2591*/
395 qregs.x.cx = strlen(target); /*;AN000;p2591*/
396 intdos(&qregs,&qregs); /*;AN000;p2591*/
397 strcpy(target,argv[2]); /*;AN000;p2591*/
398
399 for (t=&target[0]; *t!=NUL; t++)
400 if /*;AN000;p2591*/
401 ( strcmp(t,"LPT1")==0 || /*;AN000;p2591*/
402 strcmp(t,"LPT2")==0 || /*;AN000;p2591*/
403 strcmp(t,"PRN")==0 || /*;AN000;p2591*/
404 strcmp(t,"CON")==0 || /*;AN000;p2591*/
405 strcmp(t,"NUL")==0 || /*;AN000;p2591*/
406 strcmp(t,"AUX")==0 || /*;AN000;p2591*/
407 strcmp(t,"LPT1:")==0 || /*;AN000;p2591*/
408 strcmp(t,"LPT2:")==0 || /*;AN000;p2591*/
409 strcmp(t,"PRN:")==0 || /*;AN000;p2591*/
410 strcmp(t,"CON:")==0 || /*;AN000;p2591*/
411 strcmp(t,"NUL:")==0 || /*;AN000;p2591*/
412 strcmp(t,"AUX:")==0 /*;AN000;p2591*/
413 ) /*;AN000;p2591*/
414 { /*;AN000;p2591*/
415 sublist.value1 = (char far *)t; /*;AN000;p2591*/
416 sublist.flags1 = LEFT_ALIGN + CHAR_FIELD_ASCIIZ; /*;AN000;p2591*/
417 sublist.one = 0; /*;AN000;p2591*/
418 sublist.max_width1 = (BYTE)strlen(t); /*;AN000;p2591*/
419 sublist.min_width1 = sublist.max_width1; /*;AN000;p2591*/
420
421 display_it(INVPARM,STND_ERR_DEV,1,NO_RESPTYPE,(BYTE)PARSEERROR);/*;AN000;p2591*/
422 usererror(INVALIDPARM); /*;AN000;p2591*/
423 } /*;AN000;p2591*/
424
425
426 return; /*;AN000;p2591*/
427} /*;AN000;p2591*/
428
429/** ***********************************************/
430/*
431/* SUBROUTINE NAME: check_source_drive
432/*
433/* FUNCTION:
434/*
435/* Verify drive letter and start building srcddir
436/*
437/**************************************************/
438void check_source_drive(argc,argv) /*;AN000;4*/
439int argc; /*;AN000;4*/
440char *argv[]; /*;AN000;4*/
441{ /*;AN000;4*/
442 WORD retcode; /*;AC000;*/
443 WORD device_handle;
444 WORD action;
445 BYTE parm;
446 BYTE media_type;
447 WORD dnumwant = 1;
448 BYTE temp_array1[4];
449 BYTE temp_array2[4];
450 union REGS qregs; /*;AN000;8*/
451
452 *argv[1]=(BYTE)com_toupper(*argv[1]); /*;AN000;4*/
453
454 if ( /*;AN000;4*/
455 *argv[1] < 'A' || /*;AN000;4*/
456 *argv[1] > 'Z' || /*;AN000;4*/
457 *(argv[1]+1)!=':' || /*;AN000;4*/
458 *(argv[1]+2)!=NUL /*;AN000;4*/
459 ) /*;AN000;4*/
460 { /*;AN000;4*/
461 display_it(INVALID_DRIVE,STND_ERR_DEV,0,NO_RESPTYPE,(BYTE)UTIL_MSG);/*;AN000;6*/
462 usererror(INVALIDDRIVE); /*;AN000;4*/
463 } /*;AN000;4*/
464
465 srcd = (BYTE)*argv[1]; /*;AN000;4*/
466 srcddir[0] = srcd; /*;AN000;4*/
467 srcddir[1] = ':'; /*;AN000;4*/
468 srcddir[2] = NUL; /*;AN000;4*/
469
470 /***********************************************************************/
471 /* dosopen to find out whether the src drive exist */
472 /* and dosdevioctl to find out whether it is a removable drive */
473 /***********************************************************************/
474 retcode = /*;AC000;4*/
475 DOSOPEN /*;AC000;4*/
476 ( (char far *)&srcddir[0], /*;AC000;4*/
477 (unsigned far *)&device_handle, /*;AC000;4*/
478 (unsigned far *)&action, /*;AC000;4*/
479 (DWORD)0, /*file size*/ /*;AC000;4*/
480 0, /*file attribute*/ /*;AC000;4*/
481 0x01, /*if file exist, open it*/ /*;AC000;4*/
482 /*if file not exist, fail it*//*;AC000;4*/
483 0x80c2, /*deny write, read only*/ /*;AC000;4*/
484 (DWORD)0 /*reserved*/ /*;AC000;4*/
485 ); /*;AC000;4*/
486
487 if (retcode != NOERROR) /*;AC000;4*/
488 { /*;AC000;4*/
489 display_it(INVALID_DRIVE,STND_ERR_DEV,0,NO_RESPTYPE,(BYTE)UTIL_MSG);/*;AN000;6*/
490 usererror(INVALIDDRIVE); /*;AC000;4*/
491 } /*;AC000;4*/
492
493 /************************************/ /*;AC000;4*/
494 /* See if source drive is removable */ /*;AC000;4*/
495 /************************************/ /*;AC000;4*/
496 retcode = /*;AC000;4*/
497 DOSDEVIOCTL /*;AC000;4*/
498 ( (char far *)&media_type, /*;AC000;4*/
499 (char far *)&parm, /*;AC000;4*/
500 0x20, /*;AC000;4*/
501 0x08, /*;AC000;4*/
502 device_handle /*;AC000;4*/
503 ); /*;AC000;4*/
504
505 if (retcode != NOERROR) /*;AC000;4*/
506 { display_it(INVALID_DRIVE,STND_ERR_DEV,0,NO_RESPTYPE,(BYTE)UTIL_MSG);/*;AN000;6*/
507 usererror(INVALIDDRIVE); /*;AC000;4*/
508 } /*;AC000;4*/
509
510#define REMOVABLE 0 /*;AC000;4*/
511 if (media_type != REMOVABLE) /*;AC000;4*/
512 set_reset_test_flag(&control_flag2,SRC_HDISK,SET); /*;AC000;4*/
513
514 else /* Source disk is removable */ /*;AC000;4*/
515 { /*;AC000;4*/
516 temp_array1[0] = (BYTE)((dnumwant / 10) + '0'); /*;AC000;4*/
517 temp_array1[1] = (BYTE)((dnumwant % 10) + '0'); /*;AC000;4*/
518 temp_array1[2] = NUL; /*;AC000;4*/
519 temp_array2[0] = srcd; /*;AC000;4*/
520 temp_array2[1] = NUL; /*;AC000;4*/
521
522 sublist.value1 = (char far *)temp_array1; /*;AN000;6*/
523 sublist.flags1 = LEFT_ALIGN + CHAR_FIELD_ASCIIZ; /*;AN000;6*/
524 sublist.max_width1 = (BYTE)strlen(temp_array1); /*;AN000;6*/
525 sublist.min_width1 = sublist.max_width1; /*;AN000;6*/
526
527 sublist.value2 = (char far *)temp_array2; /*;AN000;6*/
528 sublist.flags2 = LEFT_ALIGN + CHAR_FIELD_ASCIIZ; /*;AN000;6*/
529 sublist.max_width2 = (BYTE)strlen(temp_array2); /*;AN000;6*/
530 sublist.min_width2 = sublist.max_width2; /*;AN000;6*/
531
532 display_it(INSERT_SOURCE_DISK,STND_ERR_DEV,2,NO_RESPTYPE,(BYTE)UTIL_MSG); /*;AN000;6*/
533 display_it(PRESS_ANY_KEY,STND_ERR_DEV,0,ANY_KEY_RESPTYPE,(BYTE)UTIL_MSG); /*;AN000;6*/
534
535 /* If single drive system, eliminates double prompting */
536 /* for user to "Insert diskette for drive %1" */
537 qregs.x.ax = SETLOGICALDRIVE; /*;AN000;8*/
538 qregs.h.bl = srcddir[0] - 'A' + 1; /*;AN000;8*/
539 intdos(&qregs,&qregs); /*;AN000;8*/
540
541 } /*;AC000;4*/
542 return; /*;AN000;4*/
543} /*;AN000;4*/
544
545/** ***********************************************/
546/*
547/* SUBROUTINE NAME: check_target_filespec
548/*
549/* FUNCTION:
550/*
551/* Verify the target filespec.
552/* 1. Validate destination drive, or use default if none specified
553/* 2. Validate path, or use current dir if not specified
554/* 3. Validate the file name
555/*
556/**************************************************/
557void check_target_filespec(argc,argv) /*;AN000;4*/
558int argc; /*;AN000;4*/
559char *argv[]; /*;AN000;4*/
560{ /*;AN000;4*/
561 WORD retcode; /*;AC000;*/
562 WORD device_handle;
563 WORD action;
564 BYTE parm;
565 BYTE media_type;
566 DWORD drive_map;
567 BYTE temp_destddir[MAXPATH+2];
568 BYTE temp_array1[4];
569 BYTE temp_array2[4];
570 WORD default_drive_num;
571 WORD destd_num;
572 WORD dirlen = MAXPATH;
573 BYTE tdestddir[MAXPATH+3];
574 BYTE ttdestddir[MAXPATH+3];
575 BYTE srcf[MAXPATHF];
576 BYTE argv2_has_switch;
577 BYTE search_string[MAXPATHF+2];
578 BYTE tempp[MAXPATH];
579 WORD j,k,z;
580 BYTE *c;
581 BYTE backdir;
582 WORD dnumwant = 1;
583 union REGS qregs; /*;AN000;8*/
584
585
586 /**************************/
587 /* Uppercase the string */
588 /**************************/
589#define CAPITALIZE_STRING 0x6521 /*;AN000;p????*/
590
591 qregs.x.ax = CAPITALIZE_STRING; /*;AN000;p????*/
592 qregs.x.dx = (WORD)argv[2]; /*;AN000;p????*/
593 strcpy(tempp,argv[2]); /*;AN000;p????*/
594 qregs.x.cx = strlen(tempp); /*;AN000;p????*/
595 intdos(&qregs,&qregs); /*;AN000;p????*/
596
597
598 /***************************************************/
599 /* If no drive letter specified, use current drive */
600 /***************************************************/
601 if ( /*;AC000;4*/
602 *(argv[2]+1)!=':' || /*;AC000;4*/
603 *argv[2] < 'A' || /*;AC000;4*/
604 *argv[2] > 'Z' /*;AC000;4*/
605 ) /*;AC000;4*/
606 { /*;AC000;4*/
607 DOSQCURDISK /*;AC000;4*/
608 ( (unsigned far *)&default_drive_num, /*;AC000;4*/
609 (DWORD far *) &drive_map /*;AC000;4*/
610 ); /*;AC000;4*/
611 destd = (BYTE)(default_drive_num + 'A' - 1); /*;AC000;4*/
612 } /*;AC000;4*/
613 else /*;AC000;4*/
614 { /* User specified the destination drive*/ /*;AC000;4*/
615 destd = (BYTE)*argv[2]; /*;AC000;4*/
616 argv[2] = argv[2] + 2; /*;AC000;4*/
617 } /*;AC000;4*/
618
619 destddir[0] = destd; /*;AC000;4*/
620 destddir[1] = ':'; /*;AC000;4*/
621 destddir[2] = NUL; /*;AC000;4*/
622
623 /***********************************************************************/
624 /* if source drive and destination drive are the same, output error msg*/
625 /***********************************************************************/
626 if (srcd == destd) /*;AC000;4*/
627 { /*;AC000;4*/
628 display_it(SOURCE_TARGET_SAME,STND_ERR_DEV,0,NO_RESPTYPE,(BYTE)UTIL_MSG);/*;AN000;6*/
629 usererror(INVALIDPARM); /*;AC000;4*/
630 } /*;AC000;4*/
631
632 /***********************************************************************/
633 /* dosopen to find out whether the destination drive is exist */
634 /* and dosdevioctl to find out whether it is a removable drive */
635 /***********************************************************************/
636
637 retcode = /*;AC000;4*/
638 DOSOPEN /*;AC000;4*/
639 ( (char far *)&destddir[0], /*;AC000;4*/
640 (unsigned far *)&device_handle, /*;AC000;4*/
641 (unsigned far *)&action, /*;AC000;4*/
642 (DWORD)0, /*file size*/ /*;AC000;4*/
643 0, /*file attribute*/ /*;AC000;4*/
644 0x01, /*if file exist, open it*/ /*;AC000;4*/
645 /*if file not exist, fail it*/ /*;AC000;4*/
646 0x80c2, /*deny write, read only*/ /*;AC000;4*/
647 (DWORD)0 /*reserved*/ /*;AC000;4*/
648 ); /*;AC000;4*/
649
650 if (retcode != NOERROR)/*if open fail*/ /*;AC000;4*/
651 { /*;AC000;4*/
652 display_it(INVALID_DRIVE,STND_ERR_DEV,0,NO_RESPTYPE,(BYTE)UTIL_MSG);/*;AN000;6*/
653 usererror(INVALIDDRIVE); /*;AC000;4*/
654 } /*;AC000;4*/
655
656 /************************************/ /*;AC000;4*/
657 /* See if target drive is removable */ /*;AC000;4*/
658 /************************************/ /*;AC000;4*/
659 retcode = /*;AC000;4*/
660 DOSDEVIOCTL /*;AC000;4*/
661 ( (char far *)&media_type, /*;AC000;4*/
662 (char far *)&parm, /*;AC000;4*/
663 0x20, /*;AC000;4*/
664 0x08, /*;AC000;4*/
665 device_handle /*;AC000;4*/
666 ); /*;AC000;4*/
667
668 if (retcode != NOERROR) /*;AC000;4*/
669 { display_it(INVALID_DRIVE,STND_ERR_DEV,0,NO_RESPTYPE,(BYTE)UTIL_MSG);/*;AN000;6*/
670 usererror(INVALIDDRIVE); /*;AC000;4*/
671 } /*;AC000;4*/
672
673 if (media_type == REMOVABLE) /*;AC000;4*/
674 { temp_array1[0] = destd; /*;AC000;4*/
675 temp_array1[1] = NUL; /*;AC000;4*/
676 sublist.value1 = (char far *)temp_array1; /*;AN000;6*/
677 sublist.flags1 = LEFT_ALIGN + CHAR_FIELD_ASCIIZ; /*;AN000;6*/
678 sublist.max_width1 = (BYTE)strlen(temp_array1); /*;AN000;6*/
679 sublist.min_width1 = sublist.max_width1; /*;AN000;6*/
680
681 display_it(INSERT_TARGET_DISK,STND_ERR_DEV,1,NO_RESPTYPE,(BYTE)UTIL_MSG); /*;AN000;6*/
682 display_it(PRESS_ANY_KEY,STND_ERR_DEV,0,ANY_KEY_RESPTYPE,(BYTE)UTIL_MSG); /*;AN000;6*/
683 } /*;AC000;4*/
684
685 /* If single drive system, eliminates double prompting */
686 /* for user to "Insert diskette for drive %1" */
687 qregs.x.ax = SETLOGICALDRIVE; /*;AN000;8*/
688 qregs.h.bl = destddir[0] - 'A' + 1; /*;AN000;8*/
689 intdos(&qregs,&qregs); /*;AN000;8*/
690
691 /**********************************************************************/
692 /* save current directory of destination disk to be reset back later */
693 /**********************************************************************/
694
695 destd_num = (WORD) (destd - 'A' +1); /*;AC000;4*/
696
697 /* get current directory of destd_num (DosQCurDir) */
698 if ((retcode = /*;AC000;4*/
699 DOSQCURDIR /*;AC000;4*/
700 ( destd_num, /*;AC000;4*/
701 (char far *) tdestddir, /*;AC000;4*/
702 (unsigned far *) &dirlen) /*;AC000;4*/
703 ) != 0) /*;AC000;4*/
704 { /*;AC000;4*/
705 display_it(INVALID_DRIVE,STND_ERR_DEV,0,NO_RESPTYPE,(BYTE)UTIL_MSG);/*;AN000;6*/
706 usererror(INVALIDDRIVE); /*;AC000;4*/
707 } /*;AC000;4*/
708
709#define BACKSLASH 0x5c
710
711 if (strlen(tdestddir) != 1) /*;AC000;4*/
712 { strcpy(temp_destddir,"\\"); /*;AC000;4*/
713 strcat(temp_destddir,tdestddir); /*;AC000;4*/
714 strcpy(tdestddir,temp_destddir); /*;AC000;4*/
715 } /*;AC000;4*/
716
717
718 /**********************************************************************/
719 /* The next parameter has to be a file name with or without path, */
720 /* or a switch. In the case of there is no path, the current path */
721 /* is used. In the case of there is no file name, the global file */
722 /* name *.* is used */
723 /**********************************************************************/
724 /* argv[2] is a drive spec*/ /*;AC000;4*/
725 if (*(argv[2]+1)==':' && *argv[2] >= 'A' && *argv[2] <= 'Z' && argc!=2) /*;AC000;4*/
726 { /*;AN000;6*/
727 display_it(INVPARM,STND_ERR_DEV,0,NO_RESPTYPE,(BYTE)PARSEERROR);/*;AN000;6*/
728 usererror(INVALIDPARM); /*;AC000;4*/
729 } /*;AC000;4*/
730 else /*;AC000;4*/
731 { /*if argv[2] is not a drive spec */ /*;AC000;4*/
732 /*if argv[2] started with '/' (is a switch) or there is no argv[i]*/ /*;AC000;4*/
733 if (*argv[2] == '/' || *argv[2] == NUL || argc ==2) /*;AC000;4*/
734 { strcpy(srcf,tdestddir); /*;AC000;4*/
735 strcat(srcf,"\\*.*"); /*;AC000;4*/
736 } /*;AC000;4*/
737 else /*;AC000;4*/
738 { /*argv[2] does not started with / */ /*;AC000;4*/
739 /* find out whether part of argv[2] is switch specification */ /*;AC000;4*/
740 for (k = 0; argv[2][k] != '/' && argv[2][k] != NUL; ++k);/*;AC000;4*/
741 if (argv[2][k] == '/') /*;AC000;4*/
742 { /*;AC000;4*/
743 argv[2][k] = NUL; /*;AC000;4*/
744 argv2_has_switch = TRUE; /*;AC000;4*/
745 } /*;AC000;4*/
746
747 /*if argv[2] is \\, invalid parm */ /*;AC000;4*/
748 if (argv[2][0] == '\\' && argv[2][1] == '\\' || argv[2][0] == ':') /*;AC000;;4*/
749 { /*;AN000;6*/
750 display_it(INVPARM,STND_ERR_DEV,0,NO_RESPTYPE,(BYTE)PARSEERROR);/*;AN000;6*/
751 usererror(INVALIDPARM); /*;AC000;4*/
752 } /*;AC000;4*/
753
754 /*if argv[2] starts with '\' (it is a complete path)*/ /*;AC000;4*/
755 if (*argv[2] == '\\') /*;AC000;4*/
756 strcpy(srcf,argv[2]); /*;AC000;4*/
757 else /*;AC000;4*/
758 /* it is not a complete path, have to put current path in */ /*;AC000;;4*/
759 /* front of the string to build a complete path */ /*;AC000;4*/
760 { strcpy(srcf,tdestddir); /*;AC000;4*/
761 if (strlen(tdestddir) != 1) /*;AC000;4*/
762 strcat(srcf,"\\"); /*;AC000;4*/
763 strcat(srcf,argv[2]); /*;AC000;4*/
764 } /*endif*/ /*;AC000;4*/
765 } /*end of argv[2] does not start with '/' */ /*;AC000;4*/
766
767 j = strlen(srcf); /*;AC000;4*/
768 z = 0; /*;AC000;4*/
769 do /*;AC000;4*/
770 { for (;srcf[z] != '.' && srcf[z] != NUL; ++z); /*;AC000;4*/
771 if (srcf[z] == '.' && srcf[z+1] == '.' && /*;AC000;4*/
772 (srcf[z+2] == '\\' || srcf[z+2] == NUL)) /*;AC000;4*/
773 { backdir = TRUE; /*;AC000;4*/
774 break; /*;AC000;4*/
775 } /*;AC000;4*/
776 z = z+1; /*;AC000;4*/
777 } /*;AC000;4*/
778 while (z < j); /*;AC000;4*/
779
780 /*validate the path*/ /*;AC000;4*/
781 for (z = j; srcf[z] != '\\'; --z); /*;AC000;4*/
782 strcpy(tempp,srcf); /*;AC000;4*/
783 tempp[z] = NUL; /*;AC000;4*/
784
785 for (z = 0; tempp[z] != '*' && tempp[z] != NUL; ++z); /*;AC000;4*/
786 if (tempp[z] == '*' ) /*;AC000;4*/
787 { display_it(PATH_NOT_FOUND,STND_ERR_DEV,1,NO_RESPTYPE,(BYTE)UTIL_MSG); /*;AN000;6*/
788 usererror(INVALIDPARM); /*;AC000;4*/
789 } /*;AC000;4*/
790
791 if (backdir == TRUE) /*;AC000;4*/
792 { search_string[0] = destd; /*;AC000;4*/
793 search_string[1] = ':'; /*;AC000;4*/
794 search_string[2] = NUL; /*;AC000;4*/
795 if (srcf[0] == NUL) /*;AC000;4*/
796 strcat(search_string,"\\"); /*;AC000;4*/
797 else /*;AC000;4*/
798 strcat(search_string, tempp); /*;AC000;4*/
799
800 if(chdir(search_string)!=0) /*;AC000;4*/
801 { sublist.value1 = (char far *)argv[2]; /*;AN000;6*/
802 sublist.flags1 = LEFT_ALIGN + CHAR_FIELD_ASCIIZ; /*;AN000;6*/
803 sublist.max_width1 = (BYTE)strlen(argv[2]); /*;AN000;6*/
804 sublist.min_width1 = sublist.max_width1; /*;AN000;6*/
805 display_it(PATH_NOT_FOUND,STND_ERR_DEV,1,NO_RESPTYPE,(BYTE)UTIL_MSG); /*;AN000;6*/
806 usererror(INVALIDPARM); /*;AC000;4*/
807 } /*;AC000;4*/
808
809 dirlen = MAXPATH; /*;AC000;4*/
810 if ((retcode = DOSQCURDIR(destd_num, /*;AC000;4*/
811 (char far *) ttdestddir, /*;AC000;4*/
812 (unsigned far *) &dirlen)) != NOERROR) /*;AC000;4*/
813 { /*;AC000;4*/
814 com_msg(retcode); /*;AC000;4*/
815 usererror(retcode); /*;AC000;4*/
816 } /*;AC000;4*/
817 /* endif */ /*;AC000;4*/
818
819 temp_destddir[0] = destd; /*;AC000;4*/
820 temp_destddir[1] = ':'; /*;AC000;4*/
821 temp_destddir[2] = NUL; /*;AC000;4*/
822 strcat(temp_destddir,tdestddir); /*;AC000;4*/
823 chdir(temp_destddir); /*;AC000;4*/
824
825 if (strlen(ttdestddir) != 1) /*;AC000;4*/
826 { strcpy(temp_destddir,"\\"); /*;AC000;4*/
827 strcat(temp_destddir,ttdestddir); /*;AC000;4*/
828 strcpy(ttdestddir,temp_destddir); /*;AC000;4*/
829 } /*;AC000;4*/
830
831 strcat(ttdestddir,"\\"); /*;AC000;4*/
832 strcat(ttdestddir,srcf+z+1); /*;AC000;4*/
833 strcpy(srcf,ttdestddir); /*;AC000;4*/
834 } /*end of if backdir is true */ /*;AC000;4*/
835
836 /* The documentation says if path is specified, file name has to */
837 /* be specified also. This logic actually allows user to specify*/
838 /* path without specify filename, as long as the path end with */
839 /* '\'.*/
840 /*If *srcf ends with '\', add "*.*" to the end*/ /*;AC000;4*/
841 j = strlen(srcf); /*;AC000;4*/
842 if (srcf[j-1] == '\\') /*;AC000;4*/
843 strcat(srcf,"*.*"); /*;AC000;4*/
844 if (argv2_has_switch == TRUE) /*;AC000;4*/
845 { *(argv[2]+k) = '/'; /*;AC000;4*/
846 argv[2] = argv[2] + k; /*;AC000;4*/
847 } /* end of if argv[2] started with '/' */ /*;AC000;4*/
848 } /* end of checking for argv[2] */ /*;AC000;4*/
849
850 /**********************************************************************/
851 /* add '\' at the beginning of the current destination directory */
852 /**********************************************************************/
853 temp_destddir[0] = destd; /*;AC000;4*/
854 temp_destddir[1] = ':'; /*;AC000;4*/
855 temp_destddir[2] = NUL; /*;AC000;4*/
856 strcat(temp_destddir,tdestddir); /*;AC000;4*/
857 strcpy(destddir,temp_destddir); /*;AC000;4*/
858
859 /************************************************************************/
860 /* separate the filename for search into prefix(inpath), */
861 /* filename(infname), and file extension (infext) */
862 /* Also take care of the situation that user enter '.' only */
863 /* for file spec. */
864 /************************************************************************/
865 separate(srcf,inpath,infname,infext,infspec); /*;AC000;4*/
866 if (strlen(infname) > MAXFNAME-1 || /*;AC000;4*/
867 strlen(infext) > MAXFEXT-1 || /*;AC000;4*/
868 strlen(inpath) > MAXPATH-1 || /*;AC000;4*/
869 strcmp(infspec,"LPT1")==0 || /*;AC000;4*/
870 strcmp(infspec,"LPT2")==0 || /*;AC000;4*/
871 strcmp(infspec,"PRN")==0 || /*;AC000;4*/
872 strcmp(infspec,"CON")==0 || /*;AC000;4*/
873 strcmp(infspec,"NUL")==0 || /*;AC000;4*/
874 strcmp(infspec,"AUX")==0 || /*;AC000;4*/
875 strcmp(infspec,"LPT1:")==0 || /*;AC000;4*/
876 strcmp(infspec,"LPT2:")==0 || /*;AC000;4*/
877 strcmp(infspec,"PRN:")==0 || /*;AC000;4*/
878 strcmp(infspec,"CON:")==0 || /*;AC000;4*/
879 strcmp(infspec,"NUL:")==0 || /*;AC000;4*/
880 strcmp(infspec,"AUX:")==0 ) /*;AC000;4*/
881 { /*;AC000;4*/
882 sublist.value1 = (char far *)&infspec[0]; /*;AN000;6*/
883 sublist.flags1 = LEFT_ALIGN + CHAR_FIELD_ASCIIZ; /*;AN000;6*/
884 sublist.one = 0; /* Yes, this is right */ /*;AN000;6*/
885 sublist.max_width1 = (BYTE)strlen(infspec); /*;AN000;6*/
886 sublist.min_width1 = sublist.max_width1; /*;AN000;6*/
887
888 display_it(INVPARM,STND_ERR_DEV,1,NO_RESPTYPE,(BYTE)PARSEERROR);/*;AN000;6*/
889 usererror(INVALIDPARM); /* invalid parm */ /*;AC000;4*/
890 } /*;AC000;4*/
891
892 /************************************************************************/
893 /* set wildcard flag according to whether there is '*' or/and '?' in */
894 /* file specification */
895 /************************************************************************/
896 c = infspec; /*;AC000;4*/
897 while (*c) /*;AC000;4*/
898 { /*;AC000;4*/
899 if (*c == '*' || *c == '?') /*;AC000;4*/
900 { set_reset_test_flag(&control_flag,WILDCARD,SET); /*;AC000;4*/
901 break; /*;AC000;4*/
902 } /*;AC000;4*/
903 else /*;AC000;4*/
904 c = c+1; /*;AC000;4*/
905 } /*;AC000;4*/
906
907
908 return; /*;AN000;4*/
909} /*;AN000;4*/
910
911/** ***********************************************/
912/*
913/* SUBROUTINE NAME: process_switch
914/*
915/* FUNCTION:
916/*
917/* Identify the switch (/S,/P,/M,/N,/B:,/A:,/E:,/L:)
918/* entered and handle it
919/*
920/**************************************************/
921void process_switch(buff_addr,ptr) /*;AN000;4*//*;AC002;*/
922unsigned buff_addr; /*;AN000;4*/
923char *ptr; /*;AN002;*/
924{ /*;AN000;4*/
925
926 if (buff_addr == (unsigned)&sw_buff) /*;AN000;4*/
927 { /*;AN000;4*/
928 if (sw_buff.sw_synonym_ptr == (WORD)&sw3.switch1[0]) /*;AN000;4 /S */
929 {set_reset_test_flag(&rtswitch, SUB, SET); /*;AN000;4*/
930 }
931
932 if (sw_buff.sw_synonym_ptr == (WORD)&sw3.switch2[0]) /*;AN000;4 /P */
933 { /*;AN000;4*/
934 set_reset_test_flag(&rtswitch, PROMPT, SET); /*;AN000;4*/
935 set_reset_test_flag(&control_flag, SWITCHES, SET); /*;AN000;4*/
936 } /*;AN000;4*/
937
938 if (sw_buff.sw_synonym_ptr == (WORD)&sw3.switch3[0]) /*;AN000;4 /M */
939 { /*;AN000;4*/
940 set_reset_test_flag(&rtswitch, Revised, SET); /*;AN000;4*/
941 set_reset_test_flag(&control_flag, SWITCHES, SET); /*;AN000;4*/
942 } /*;AN000;4*/
943
944 if (sw_buff.sw_synonym_ptr == (WORD)&sw3.switch4[0]) /*;AN000;4 /N */
945 { /*;AN000;4*/
946 set_reset_test_flag(&rtswitch, NOTEXIST, SET); /*;AN000;4*/
947 set_reset_test_flag(&control_flag, SWITCHES, SET); /*;AN000;4*/
948 } /*;AN000;4*/
949 } /*;AN000;4*/
950
951
952 if (buff_addr == (unsigned)&time_buff) /*;AN000;4*/
953 { /*;AN000;4*/
954 check_time(time_buff.hours,time_buff.minutes,time_buff.seconds,time_buff.hundreds); /*;AN000;4*//*;AC002;*/
955
956 if (time_buff.tb_synonym_ptr == (WORD)&sw2.switch1[0]) /*;AN000;4 /E */
957 { /*;AN000;4*/
958 td.earlier_hour = time_buff.hours; /*;AN000;4*/
959 td.earlier_minute = time_buff.minutes; /*;AN000;4*/
960 td.earlier_second = time_buff.seconds; /*;AN000;4*/
961 set_reset_test_flag(&rtswitch, EARLIER, SET); /*;AN000;4*/
962 set_reset_test_flag(&control_flag, SWITCHES, SET); /*;AN000;4*/
963 } /*;AN000;4*/
964
965 if (time_buff.tb_synonym_ptr == (WORD)&sw2.switch2[0]) /*;AN000;4 /L */
966 { /*;AN000;4*/
967 td.later_hour = time_buff.hours; /*;AN000;4*/
968 td.later_minute = time_buff.minutes; /*;AN000;4*/
969 td.later_second = time_buff.seconds; /*;AN000;4*/
970 set_reset_test_flag(&rtswitch, LATER, SET); /*;AN000;4*/
971 set_reset_test_flag(&control_flag, SWITCHES, SET); /*;AN000;4*/
972 } /*;AN000;4*/
973
974 } /*;AN000;4*/
975
976
977 if (buff_addr == (unsigned)&date_buff) /*;AN000;4*/
978 { /*;AN000;4*/
979 check_date(date_buff.year,date_buff.month,date_buff.day); /*;AN000;4*//*;AC002;*/
980
981 if (date_buff.db_synonym_ptr == (WORD)&sw1.switch1[0]) /*;AN000;4 /B */
982 { /*;AN000;4*/
983 td.before_year = date_buff.year; /*;AN000;4*/
984 td.before_month = date_buff.month; /*;AN000;4*/
985 td.before_day = date_buff.day; /*;AN000;4*/
986 set_reset_test_flag(&rtswitch, BEFORE, SET); /*;AN000;4*/
987 set_reset_test_flag(&control_flag, SWITCHES, SET); /*;AN000;4*/
988 } /*;AN000;4*/
989
990 if (date_buff.db_synonym_ptr == (WORD)&sw1.switch2[0]) /*;AN000;4 /A */
991 { /*;AN000;4*/
992 td.after_year = date_buff.year; /*;AN000;4*/
993 td.after_month = date_buff.month; /*;AN000;4*/
994 td.after_day = date_buff.day; /*;AN000;4*/
995 set_reset_test_flag(&rtswitch, AFTER, SET); /*;AN000;4*/
996 set_reset_test_flag(&control_flag, SWITCHES, SET); /*;AN000;4*/
997 } /*;AN000;4*/
998
999 } /*;AN000;4*/
1000
1001 return; /*;AN000;4*/
1002} /*;AN000;4*/