w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

sh3.c
Go to the documentation of this file.
1 /*
2  * MS-DOS SHELL - Parse Tree Executor
3  *
4  * MS-DOS SHELL - Copyright (c) 1990,4 Data Logic Limited and Charles Forsyth
5  *
6  * This code is based on (in part) the shell program written by Charles
7  * Forsyth and is subject to the following copyright restrictions:
8  *
9  * 1. Redistribution and use in source and binary forms are permitted
10  * provided that the above copyright notice is duplicated in the
11  * source form and the copyright notice in file sh6.c is displayed
12  * on entry to the program.
13  *
14  * 2. The sources (or parts thereof) or objects generated from the sources
15  * (or parts of sources) cannot be sold under any circumstances.
16  *
17  * When parts of the original 2.1 shell were replaced by the Lexical
18  * Analsyer written by Simon J. Gerraty (for his Public Domain Korn Shell,
19  * which is also based on Charles Forsyth original idea), a number of changes
20  * were made to reflect the changes Simon made to the Parse output tree. Some
21  * parts of this code in this module are based on the algorithms/ideas that
22  * he incorporated into his shell, in particular the TCASE and TTIME
23  * functionality in ExecuteParseTree, and the PrintAList function.
24  *
25  * $Header: /usr/users/istewart/shell/sh2.3/Release/RCS/sh3.c,v 2.17 1994/08/25 20:49:11 istewart Exp $
26  *
27  * $Log: sh3.c,v $
28  * Revision 2.17 1994/08/25 20:49:11 istewart
29  * MS Shell 2.3 Release
30  *
31  * Revision 2.16 1994/02/23 09:23:38 istewart
32  * Beta 233 updates
33  *
34  * Revision 2.15 1994/02/01 10:25:20 istewart
35  * Release 2.3 Beta 2, including first NT port
36  *
37  * Revision 2.14 1994/01/20 14:51:43 istewart
38  * Release 2.3 Beta 1
39  *
40  * Revision 2.13 1994/01/11 17:55:25 istewart
41  * Release 2.3 Beta 0 patches
42  *
43  * Revision 2.12 1993/11/09 10:39:49 istewart
44  * Beta 226 checking
45  *
46  * Revision 2.11 1993/08/25 16:03:57 istewart
47  * Beta 225 - see Notes file
48  *
49  * Revision 2.10 1993/07/02 10:21:35 istewart
50  * 224 Beta fixes
51  *
52  * Revision 2.9 1993/06/14 11:00:12 istewart
53  * More changes for 223 beta
54  *
55  * Revision 2.8 1993/06/02 09:52:35 istewart
56  * Beta 223 Updates - see Notes file
57  *
58  * Revision 2.7 1993/02/16 16:03:15 istewart
59  * Beta 2.22 Release
60  *
61  * Revision 2.6 1993/01/26 18:35:09 istewart
62  * Release 2.2 beta 0
63  *
64  * Revision 2.5 1992/12/14 10:54:56 istewart
65  * BETA 215 Fixes and 2.1 Release
66  *
67  * Revision 2.4 1992/11/06 10:03:44 istewart
68  * 214 Beta test updates
69  *
70  * Revision 2.3 1992/09/03 18:54:45 istewart
71  * Beta 213 Updates
72  *
73  * Revision 2.2 1992/07/16 14:33:34 istewart
74  * Beta 212 Baseline
75  *
76  * Revision 2.1 1992/07/10 10:52:48 istewart
77  * 211 Beta updates
78  *
79  * Revision 2.0 1992/05/07 20:31:39 Ian_Stewartson
80  * MS-Shell 2.0 Baseline release
81  *
82  */
83 
84 #include <sys/types.h>
85 #include <sys/stat.h>
86 #include <stdio.h>
87 #include <signal.h>
88 #include <errno.h>
89 #include <setjmp.h>
90 #include <ctype.h>
91 #include <string.h>
92 #include <unistd.h>
93 #include <stdlib.h>
94 #include <fcntl.h>
95 #include <limits.h>
96 #include <dirent.h>
97 #include <ctype.h>
98 #include <time.h>
99 #include "sh.h"
100 
101 /*
102  * Save struct for Parameters ($1, $2 etc)
103  */
104 
105 typedef struct SaveParameters {
106  char **Array; /* The parameters */
107  int Count; /* Number of them */
109 
110 /* static Function and string declarations */
111 
112 static int F_LOCAL ForkAndExecute (C_Op *, int, int, int, char **, char **,
113  char **);
114 static bool F_LOCAL SetUpIOHandlers (IO_Actions *, int, int);
115 static bool F_LOCAL WriteToExtendedFile (FILE *, char *);
116 static void F_LOCAL EchoCurrentCommand (char **);
117 static int F_LOCAL ExecuteProgram (char *, char **, char **, int);
118 static bool F_LOCAL CheckParameterLength (char **);
119 static void F_LOCAL SaveNumericParameters (char **, SaveParameters *);
121 static bool F_LOCAL ExecuteFunction (char **, int *, bool);
122 static void F_LOCAL PrintLoadError (char *);
123 static void F_LOCAL TrackAllCommands (char *, char *);
124 static int F_LOCAL ExtensionType (char *);
125 static char * F_LOCAL FindFileAndExtension (char *, char *, char **);
126 static bool F_LOCAL GetApplicationType (char *);
127 static bool F_LOCAL BadApplication (char *);
128 static bool F_LOCAL SetUpCLI (char *, Word_B **);
129 
130 #ifdef OS_SWAPPING
131 static bool F_LOCAL Get_EMS_Driver (void);
132 static bool F_LOCAL Get_XMS_Driver (void);
133 static bool F_LOCAL EMS_error (char *, int);
134 static int F_LOCAL EMS_Close (void);
135 static bool F_LOCAL XMS_error (char *, int);
136 static int F_LOCAL XMS_Close (void);
137 static int F_LOCAL SwapToDiskError (int, char *);
138 static int F_LOCAL SwapToMemory (int, char **);
139 static int F_LOCAL SpawnProcess (char **);
140 static int F_LOCAL CheckForExecOnly (char *, int, int);
141 #endif
142 
143 static char * F_LOCAL ConvertErrorNumber (void);
144 static int F_LOCAL BuildCommandLine (char *, char **, char **, int);
145 static int F_LOCAL StartTheProcess (char *, char **, char **, int);
146 static int F_LOCAL SetCommandReturnStatus (int);
147 static char ** F_LOCAL FindNumberOfValues (char **, int *);
148 static int F_LOCAL ExecuteScriptFile (char *, char **, char **, int, bool);
149 #if (OS_TYPE != OS_UNIX)
150 static int F_LOCAL ExecuteWindows (char *, char **, char **, int);
151 #endif
152 static int F_LOCAL ExecuteSpecialProcessor (char *, char **, char **, int,
153  Word_B *);
154 static int F_LOCAL EnvironExecute (char **, int);
155 static int F_LOCAL LocalExecve (char **, char **, int);
156 static unsigned int F_LOCAL CheckForCommonOptions (LineFields *, int);
157 static char ** F_LOCAL ProcessSpaceInParameters (char **);
158 static int F_LOCAL CountDoubleQuotes (char *);
159 static void BuildEnvironmentEntry (const void *, VISIT, int);
160 static char ** F_LOCAL BuildCommandEnvironment (void);
161 
162 #if (OS_TYPE != OS_DOS)
163 static void F_LOCAL PrintPidStarted (void);
164 
165 # if (OS_TYPE == OS_OS2)
166 static char *InsertCharacterAtStart (char *);
167 static int F_LOCAL OS_DosExecProgram (int, char *, char **, char **);
168 # elif (OS_TYPE == OS_NT)
169 static int F_LOCAL OS_DosExecProgram (int, char *, char **, char **);
170 # endif
171 #else
172 # define PrintPidStarted()
173 # define InsertCharacterAtStart(a)
174 #endif
175 
176 #if (OS_TYPE == OS_OS2)
177 static int F_LOCAL StartTheSession (STARTDATA *, char *, char **,
178  char **, int);
179 #endif
180 
181 static char *AE2big = "arg/env list too big";
182  /* Extended Command line processing file name */
183 static char *Extend_file = (char *)NULL;
184 static char *DoubleQuotes = "\"";
185 static char *WildCards = "*?[\"'";
186 static unsigned long ApplicationType;
187 
188 #if (OS_TYPE == OS_DOS)
189 static char *LIT_STARTWINP = "STARTWINP";
190 #endif
191 
192 /*
193  * Global variables for TWALK to build command environment
194  */
195 
197 static int BCE_Length;
198 
199 /*
200  * List of Executable (shell script, .exe, .com) extensions and list
201  * including functions.
202  */
203 
204 static char **ExecutableList = (char **)NULL;
205 static char **ExecuteFunctionList = (char **)NULL;
206 
207 /* Swapping messages */
208 
209 #ifdef OS_SWAPPING
210 static char *NoSwapFiles = "No Swap files";
211 static char *MS_emsg = "Warning: %s Error (%x)";
212 static char *MS_Space = "Warning: %s out of space";
213 static char *SwapFailed = "%s swap failed (%x)";
214 static char *Swap_File = (char *)NULL; /* Swap file */
215 #endif
216 
217 /*
218  * OS2 load error mode
219  */
220 
221 #if (OS_TYPE == OS_OS2)
222 static char FailName[FFNAME_MAX];
223 #endif
224 
225 #if (OS_TYPE != OS_DOS)
226 static OSCALL_RET OS_DosExecPgmReturnCode;
227 #endif
228 
229 /*
230  * Program started info
231  */
232 
233 #if (OS_TYPE != OS_DOS)
234 struct PidInfo {
235  bool Valid;
236  int JobNo;
237  int PidNo;
238 } PidInfo;
239 #endif
240 
241 /*
242  * Common fields in EXTENDED_LINE file
243  */
244 
245 #define COMMON_FIELD_COUNT ARRAY_SIZE (CommonFields)
246 
247 static struct CommonFields {
248  char *Name;
249  unsigned int Flag;
250 } CommonFields [] = {
251  { "switch", EP_CONVERT },
252  { LIT_export, EP_EXPORT },
253  { "noswap", EP_NOSWAP },
254  { "noexpand", EP_NOEXPAND },
255  { "noquote", EP_NOQUOTE },
256  { "ignoretype", EP_IGNTYPE },
257  { "pipetty", EP_PSEUDOTTY },
258  { "quotewild", EP_QUOTEWILD }
259 };
260 
261 /*
262  * execute tree recursively
263  */
264 
266  int StandardIN,
267  int StandardOUT,
268  int Actions)
269 {
270  int Count;
271  int LocalPipeFP; /* Pipe handlers */
272 
273 #if (OS_TYPE != OS_DOS)
274  int ReadPipeFP;
275  int WritePipeFP;
276 # if OS_TYPE == OS_NT
277  extern int _open_osfhandle (long, int);
278  HANDLE ReadPipeH;
279  HANDLE WritePipeH;
280 # endif
281 #endif
282 
283  char *cp;
284  char **AList; /* Argument list */
285  Break_C BreakContinue;
286  /* Save longjmp returns */
287  Break_C *S_RList = Return_List;
288  Break_C *S_BList = Break_List;
289  Break_C *S_SList = SShell_List;
290 
291  GetoptsIndex GetoptsSave;
292  int Local_depth; /* Save local values */
293  int Local_MemoryAreaLevel;
294  int RetVal = 0; /* Return value */
295  char *InputBuffer; /* Select input Buffer */
296  char *EndIB; /* End of buffer */
297  char *LastWord = null;
298 
299 /* End of tree ? */
300 
301  if (t == (C_Op *)NULL)
302  return SetCommandReturnStatus (0);
303 
304  DPRINT (1, ("ExecuteParseTree: t->type = %d, Depth = %d",
305  t->type, Execute_stack_depth));
306 
307 /* Save original and Increment execute function recursive level */
308 
309  Local_depth = Execute_stack_depth++;
310 
311 /* Save original and increment area number */
312 
313  Local_MemoryAreaLevel = MemoryAreaLevel++;
314 
315 /* Switch on tree node type */
316 
317  switch (t->type)
318  {
319  case TFUNC: /* name () { list; } */
320  RetVal = SaveFunction (t) ? 0 : 1;
321  SetCommandReturnStatus (RetVal);
322  break;
323 
324 /* In the case of a () command string, we need to save and restore the
325  * current environment, directory and traps (can't think of anything else).
326  * For any other, we just restore the current directory. Also, we don't
327  * want changes in the Variable list header saved for SubShells, because
328  * we are effectively back at execute depth zero.
329  */
330  case TPAREN: /* () */
331  if ((RetVal = CreateGlobalVariableList (FLAGS_NONE)) == -1)
332  break;
333 
334 /* Save Getopts pointers */
335 
336  GetGetoptsValues (&GetoptsSave);
337 
338 
339  if (setjmp (BreakContinue.CurrentReturnPoint) == 0)
340  {
341  Return_List = (Break_C *)NULL;
342  Break_List = (Break_C *)NULL;
343  BreakContinue.NextExitLevel = SShell_List;
344  SShell_List = &BreakContinue;
345  RetVal = ForkAndExecute (t, StandardIN, StandardOUT, Actions,
346  NOWORDS, NOWORDS, &LastWord);
347  }
348 
349 /* Restore the original environment */
350 
351  else
353 
354  SaveGetoptsValues (GetoptsSave.Index, GetoptsSave.SubIndex);
355  Return_List = S_RList;
356  Break_List = S_BList;
357  SShell_List = S_SList;
358  RestoreEnvironment (RetVal, Local_depth);
359  break;
360 
361 /* After a normal command, we need to restore the original directory. Note
362  * that a cd will have updated the variable $~, so no problem
363  */
364 
365  case TCOM: /* A command process */
366  {
367  ExeMode SaveValues;
368  char **SetVlist; /* Set variable list */
369 
370  SetVlist = ExpandWordList (t->vars, EXPAND_TILDE, (ExeMode *)NULL);
371  AList = ExpandWordList (t->args, EXPAND_SPLITIFS | EXPAND_GLOBBING |
372  EXPAND_TILDE, &SaveValues);
373 
374  ExecProcessingMode = SaveValues;
375 
376 #if (OS_TYPE != OS_DOS)
377  PidInfo.Valid = FALSE;
378 #endif
379 
380  RetVal = ForkAndExecute (t, StandardIN, StandardOUT, Actions,
381  AList, SetVlist, &LastWord);
382 
383  PrintPidStarted ();
384  RestoreEnvironment (RetVal, Local_depth);
385 
386 /* Save last word if appropriate */
387 
389  {
392  }
393  break;
394  }
395 
396  case TTIME: /* Time a command process */
397  {
398  clock_t stime;
399  clock_t etime;
400  clock_t dif;
401 
402  stime = clock ();
403  RetVal = ExecuteParseTree (t->left, StandardIN, StandardOUT, 0);
404  etime = clock ();
405 
407 
408  if ((dif = (etime - stime) / (60L * (clock_t)CLOCKS_PER_SEC)))
409  fprintf (stderr, "%ldm ", dif);
410 
411  dif = (etime - stime) % (60L * (clock_t)CLOCKS_PER_SEC);
412 
413  fprintf (stderr, "%ld.%.3lds real\n",
414  dif / (clock_t)CLOCKS_PER_SEC,
415  dif % (clock_t)CLOCKS_PER_SEC);
416 
417  break;
418  }
419 
420  case TPIPE: /* Pipe processing */
421 
422  Actions |= EXEC_PIPE_IN;
423 
424 #if (OS_TYPE == OS_UNIX)
425  fputs ("UNIX: Pipes not implemented\n", stderr);
426  RetVal = -1;
427 
428 #else
429 # if (OS_TYPE != OS_DOS)
430 /* Do we want to use real pipes under OS2? */
431 
433  {
434 # if (OS_TYPE == OS_OS2)
435 # if (OS_SIZE == OS_32)
436  if (DosCreatePipe ((PHFILE) &ReadPipeFP,
437  (PHFILE) &WritePipeFP, 4096))
438  break;
439 # else
440  if (DosMakePipe ((PHFILE) &ReadPipeFP,
441  (PHFILE) &WritePipeFP, 0))
442  break;
443 # endif
444 
445 /* Remap the IO handler */
446 
447  ReadPipeFP = ReMapIOHandler (ReadPipeFP);
448  WritePipeFP = ReMapIOHandler (WritePipeFP);
449  DosSetFHandState (ReadPipeFP, OPEN_FLAGS_NOINHERIT);
450  DosSetFHandState (WritePipeFP, OPEN_FLAGS_NOINHERIT);
451 
452 # elif (OS_TYPE == OS_NT)
453  if (!CreatePipe (&ReadPipeH, &WritePipeH, 0, 0))
454  break;
455 
456 /* Remap the IO handler */
457 
458  ReadPipeFP = _open_osfhandle ((long)ReadPipeH, _O_RDONLY);
459  WritePipeFP = _open_osfhandle ((long)WritePipeH, _O_APPEND);
460  ReadPipeFP = ReMapIOHandler (ReadPipeFP);
461  WritePipeFP = ReMapIOHandler (WritePipeFP);
462 # endif
463 
464 
465 /* Is this a foreground thingy? */
466 
467  if (!(Actions & (EXEC_SPAWN_NOWAIT | EXEC_SPAWN_IGNOREWAIT)))
468  {
469  int WaitPid;
470 
471  WaitPid = ExecuteParseTree (t->left, StandardIN,
472  WritePipeFP,
473  EXEC_SPAWN_IGNOREWAIT |
474  (Actions & (EXEC_PIPE_IN |
475  EXEC_PIPE_SUBS)));
476  S_close (WritePipeFP, TRUE);
477 
478  RetVal = ExecuteParseTree (t->right, ReadPipeFP,
479  StandardOUT,
480  Actions | EXEC_PIPE_SUBS);
481  S_close (ReadPipeFP, TRUE);
482  cwait (&WaitPid, WaitPid, WAIT_GRANDCHILD);
483  }
484 
485 /* Background processing */
486 
487  else
488  {
489  ExecuteParseTree (t->left, StandardIN, WritePipeFP,
490  EXEC_SPAWN_IGNOREWAIT |
491  (Actions & (EXEC_PIPE_IN |
492  EXEC_PIPE_SUBS)));
493 
494  S_close (WritePipeFP, TRUE);
495 
496  RetVal = ExecuteParseTree (t->right, ReadPipeFP,
497  StandardOUT,
498  Actions | EXEC_PIPE_SUBS);
499  S_close (ReadPipeFP, TRUE);
500  }
501 
502  break;
503  }
504 # endif
505 
506 /* MSDOS or OS/2 without real pipes - use files. Safer */
507 
508  if ((RetVal = OpenAPipe ()) < 0)
509  break;
510 
511 /* Create pipe, execute command, reset pipe, execute the other side, close
512  * the pipe and fini
513  */
514 
515  LocalPipeFP = ReMapIOHandler (RetVal);
516  ExecuteParseTree (t->left, StandardIN, LocalPipeFP,
517  (Actions & (EXEC_PIPE_IN | EXEC_PIPE_SUBS)));
518 
519 /* Close the Input to release the file descriptor */
520 
521  CloseThePipe (StandardIN);
522 
523  lseek (LocalPipeFP, 0L, SEEK_SET);
524  RetVal = ExecuteParseTree (t->right, LocalPipeFP, StandardOUT,
525  Actions | EXEC_PIPE_SUBS);
526  CloseThePipe (LocalPipeFP);
527 #endif
528  break;
529 
530  case TLIST: /* Entries in a for statement */
531  while (t->type == TLIST)
532  {
533  ExecuteParseTree (t->left, StandardIN, StandardOUT, 0);
534  t = t->right;
535  }
536 
537  RetVal = ExecuteParseTree (t, StandardIN, StandardOUT, 0);
538  break;
539 
540  case TCOPROCESS: /* Co processes */
541  if (!FL_TEST (FLAG_WARNING))
542  PrintWarningMessage ("sh: co-processes not supported");
543 
544  SetCommandReturnStatus (RetVal = -1);
545  break;
546 
547  case TASYNC: /* Async - not supported */
548 #if (OS_TYPE == OS_DOS)
549  if (!FL_TEST (FLAG_WARNING))
550  PrintWarningMessage ("sh: Async commands not supported");
551 
552  SetCommandReturnStatus (RetVal = -1);
553 #else
554  RetVal = ExecuteParseTree (t->left, StandardIN, StandardOUT,
555  EXEC_SPAWN_NOWAIT);
556 #endif
557  break;
558 
559  case TOR: /* || and && */
560  case TAND:
561  RetVal = ExecuteParseTree (t->left, StandardIN, StandardOUT, 0);
562 
563  if ((t->right != (C_Op *)NULL) &&
564  ((RetVal == 0) == (t->type == TAND)))
565  RetVal = ExecuteParseTree (t->right, StandardIN, StandardOUT,
566  0);
567 
568  break;
569 
570 
571 /* for x do...done and for x in y do...done - find the start of the variables
572  * count the number.
573  */
574  case TFOR:
575  case TSELECT:
576  AList = FindNumberOfValues (ExpandWordList (t->vars,
579  EXPAND_TILDE,
580  (ExeMode *)NULL),
581  &Count);
582 
583 
584 /* Set up a long jump return point before executing the for function so that
585  * the continue statement is executed, ie we reprocessor the for condition.
586  */
587 
588  while ((RetVal = setjmp (BreakContinue.CurrentReturnPoint)))
589  {
590 
591 /* Restore the current stack level and clear out any I/O */
592 
593  RestoreEnvironment (0, Local_depth + 1);
594  Return_List = S_RList;
595  SShell_List = S_SList;
596 
597 /* If this is a break - clear the variable and terminate the while loop and
598  * switch statement
599  */
600 
601  if (RetVal == BC_BREAK)
602  break;
603  }
604 
605  if (RetVal == BC_BREAK)
606  break;
607 
608 /* Process the next entry - Add to the break/continue chain */
609 
610  BreakContinue.NextExitLevel = Break_List;
611  Break_List = &BreakContinue;
612 
613 /* Execute the command tree */
614 
615  if (t->type == TFOR)
616  {
617  while (Count--)
618  {
619  SetVariableFromString (t->str, *AList++);
620  RetVal = ExecuteParseTree (t->left, StandardIN, StandardOUT,
621  0);
622  }
623  }
624 
625 /* Select option */
626 
627  else if (!Count)
628  /* SKIP */;
629 
630 /* Get some memory for the select input buffer */
631 
633  == (char *)NULL)
634  {
636  RetVal = -1;
637  }
638 
639 /* Process the select command */
640 
641  else
642  {
643  bool OutputList = TRUE;
644 
645  EndIB = &InputBuffer[LINE_MAX - 2];
646 
647  while (TRUE)
648  {
649  int ReadCount; /* Local counter */
650  int OnlyDigits; /* Only digits in string*/
651 
652 /* Output list of words */
653 
654  if (OutputList)
655  {
656  PrintAList (Count, AList);
657  OutputList = FALSE;
658  }
659 
660 /* Output prompt */
661 
663  OnlyDigits = 1;
664 
665 /* Read in until end of line, file or a field separator is detected */
666 
667  for (cp = InputBuffer; (cp < EndIB); cp++)
668  {
669  if (((ReadCount = read (STDIN_FILENO, cp, 1)) != 1) ||
670  (*cp == CHAR_NEW_LINE))
671  {
672  break;
673  }
674 
675  OnlyDigits = OnlyDigits && isdigit (*cp);
676  }
677 
678  *cp = 0;
679 
680 /* Check for end of file */
681 
682  if (ReadCount != 1)
683  break;
684 
685 /* Check for empty line */
686 
687  if (!strlen (InputBuffer))
688  {
689  OutputList = TRUE;
690  continue;
691  }
692 
694 
695 /* Check that OnlyDigits is a valid number in the select range */
696 
697  if (OnlyDigits &&
698  ((OnlyDigits = atoi (InputBuffer)) > 0) &&
699  (OnlyDigits <= Count))
700  SetVariableFromString (t->str, AList[OnlyDigits - 1]);
701 
702  else
703  SetVariableFromString (t->str, null);
704 
705  RetVal = ExecuteParseTree (t->left, StandardIN, StandardOUT,
706  0);
707  }
708  }
709 
710 /* Remove this tree from the break list */
711 
712  Break_List = S_BList;
713  break;
714 
715 /* While and Until function. Similar to the For function. Set up a
716  * long jump return point before executing the while function so that
717  * the continue statement is executed OK.
718  */
719 
720  case TWHILE: /* WHILE and UNTIL functions */
721  case TUNTIL:
722  while ((RetVal = setjmp (BreakContinue.CurrentReturnPoint)))
723  {
724 
725 /* Restore the current stack level and clear out any I/O */
726 
727  RestoreEnvironment (0, Local_depth + 1);
728  Return_List = S_RList;
729  SShell_List = S_SList;
730 
731 /* If this is a break, terminate the while and switch statements */
732 
733  if (RetVal == BC_BREAK)
734  break;
735  }
736 
737  if (RetVal == BC_BREAK)
738  break;
739 
740 /* Set up links */
741 
742  BreakContinue.NextExitLevel = Break_List;
743  Break_List = &BreakContinue;
744 
745  while ((ExecuteParseTree (t->left, StandardIN, StandardOUT, 0) == 0)
746  == (t->type == TWHILE))
747  RetVal = ExecuteParseTree (t->right, StandardIN, StandardOUT,
748  0);
749 
750  Break_List = S_BList;
751  break;
752 
753  case TIF: /* IF and ELSE IF functions */
754  case TELIF:
755  if (t->right != (C_Op *)NULL)
756  RetVal = ExecuteParseTree (!ExecuteParseTree (t->left,
757  StandardIN,
758  StandardOUT, 0)
759  ? t->right->left : t->right->right,
760  StandardIN, StandardOUT, 0);
761 
762  break;
763 
764  case TCASE: /* CASE function */
765  {
766  C_Op *ts = t->left;
767 
768  cp = ExpandAString (t->str, 0);
769 
770  while ((ts != (C_Op *)NULL) && (ts->type == TPAT))
771  {
772  for (AList = ts->vars; *AList != NOWORD; AList++)
773  {
774  if ((EndIB = ExpandAString (*AList, EXPAND_PATTERN)) &&
775  GeneralPatternMatch (cp, (unsigned char *)EndIB, FALSE,
776  (char **)NULL, GM_ALL))
777  goto Found;
778  }
779 
780  ts = ts->right;
781  }
782 
783  break;
784 
785 Found:
786  RetVal = ExecuteParseTree (ts->left, StandardIN, StandardOUT, 0);
787  break;
788  }
789 
790  case TBRACE: /* {} statement */
791  if ((RetVal >= 0) && (t->left != (C_Op *)NULL))
792  RetVal = ExecuteParseTree (t->left, StandardIN, StandardOUT,
793  (Actions & EXEC_FUNCTION));
794 
795  break;
796  }
797 
798 /* Processing Completed - Restore environment */
799 
800  Execute_stack_depth = Local_depth;
801 
802 /* Remove unwanted malloced space */
803 
805  MemoryAreaLevel = Local_MemoryAreaLevel;
806 
807 /* Check for traps */
808 
809  if (t->type == TCOM)
810  {
811  RunTrapCommand (-1); /* Debug trap */
812 
813  if (RetVal)
814  RunTrapCommand (-2); /* Err trap */
815  }
816 
817 /* Interrupt traps */
818 
819  if ((Count = InterruptTrapPending) != 0)
820  {
823  }
824 
825 /* Check for interrupts */
826 
827  if (InteractiveFlag && IS_TTY (0) && SW_intr)
828  {
829  CloseAllHandlers ();
831  }
832 
833  return RetVal;
834 }
835 
836 /*
837  * Restore the original directory
838  */
839 
841 {
843 
844  if (!S_chdir (&path[2]))
845  {
846  if (!FL_TEST (FLAG_WARNING))
847  feputs ("Warning: current directory reset to /\n");
848 
851  }
852 }
853 
854 /*
855  * Ok - execute the program, resetting any I/O required
856  */
857 
859  int StandardIN,
860  int StandardOUT,
861  int ForkAction,
862  char **AList,
863  char **VList,
864  char **LastWord)
865 {
866  int RetVal = -1; /* Return value */
867  int (*shcom)(int, char **) = (int (*)(int, char **))NULL;
868  char *cp;
869  char **alp;
870  IO_Actions **iopp = t->ioact;
871  int builtin = 0; /* Builtin function */
872  bool CGVLCalled = FALSE;
873  bool InternalExec = FALSE;
874  int Index;
875 
876  if (t->type == TCOM)
877  {
878  cp = *AList;
879 
880 /* strip all initial assignments not correct wrt PATH=yyy command etc */
881 
882  if (FL_TEST (FLAG_PRINT_EXECUTE) ||
883  ((CurrentFunction != (FunctionList *)NULL) &&
885  EchoCurrentCommand (cp != NOWORD ? AList : VList);
886 
887 /* Is it only an assignement? */
888 
889  if ((cp == NOWORD) && (t->ioact == (IO_Actions **)NULL))
890  {
891  while (((cp = *(VList++)) != NOWORD) &&
892  AssignVariableFromString (cp, &Index))
893  continue;
894 
895 #if (OS_TYPE != OS_DOS)
896  ExitWithJobsActive = FALSE;
897 #endif
898 
899 /* Get the status variable if expand changed it */
900 
901  return (int)GetVariableAsNumeric (StatusVariable);
902  }
903 
904 /* Check for built in commands */
905 
906  else if (cp != NOWORD)
907  {
908  shcom = IsCommandBuiltIn (cp, &builtin);
909  InternalExec = C2bool ((strcmp (cp, LIT_exec)) == 0);
910 
911 /*
912  * Reset the ExitWithJobsActive flag to enable the 'jobs active' on exit
913  * message
914  */
915 
916 #if (OS_TYPE != OS_DOS)
917  if (strcmp (cp, LIT_exit))
918  ExitWithJobsActive = FALSE;
919 #endif
920  }
921 
922 #if (OS_TYPE != OS_DOS)
923  else
924  ExitWithJobsActive = FALSE;
925 #endif
926  }
927 
928 #if (OS_TYPE != OS_DOS)
929  else
930  ExitWithJobsActive = FALSE;
931 #endif
932 
933 /*
934  * UNIX fork simulation?
935  */
936 
937 /* If there is a command to execute or we are exec'ing and this is not a
938  * TPAREN, save the current environment
939  */
940 
941  if (t->type != TPAREN)
942  {
943  if (((*VList != NOWORD) &&
944  ((builtin & BLT_SKIPENVIR) != BLT_SKIPENVIR)) ||
945  (ForkAction & EXEC_WITHOUT_FORK))
946  {
948  return -1;
949 
950  CGVLCalled = TRUE;
951  }
952 
953 /* Set up any variables. Note there is an assumption that
954  * AssignVariableFromString sets the equals sign to 0, hiding the value;
955  */
956 
957  if (shcom == (int (*)(int, char **))NULL)
958  {
959  while (((cp = *(VList++)) != NOWORD) &&
960  AssignVariableFromString (cp, &Index))
961  SetVariableArrayStatus (cp, Index,
963 
964 /* If the child shells from this process communicate via pipes, set the
965  * environment so the child shell will know. This is a special case for OS/2
966  * (and Win NT?) EMACS.
967  */
968 
970  {
971  char temp[30];
972 
974  "=true"), &Index);
977  }
978  }
979  }
980 
981 
982 /* If this is the first command in a pipe, set stdin to /dev/null */
983 
984  if ((ForkAction & (EXEC_PIPE_IN | EXEC_PIPE_SUBS)) == EXEC_PIPE_IN)
985  {
986  if ((Index = S_open (FALSE, "/dev/null", O_RDONLY)) != 0)
987  {
988  S_dup2 (Index, 0);
989  S_close (Index, TRUE);
990  }
991  }
992 
993 /* We cannot close the pipe, because once the exec/spawn has taken place
994  * the processing of the pipe is not yet complete.
995  */
996 
997  if (StandardIN != NOPIPE)
998  {
999  S_dup2 (StandardIN, STDIN_FILENO);
1000  /*lseek (STDIN_FILENO, 0L, SEEK_SET);*/
1001  }
1002 
1003  if (StandardOUT != NOPIPE)
1004  {
1005  FlushStreams ();
1006  S_dup2 (StandardOUT, STDOUT_FILENO);
1008  }
1009 
1010 /* Set up any other IO required */
1011 
1012  FlushStreams ();
1013 
1014  if (iopp != (IO_Actions **)NULL)
1015  {
1016  while (*iopp != (IO_Actions *)NULL)
1017  {
1018  if (SetUpIOHandlers (*(iopp++), StandardIN, StandardOUT))
1019  return RetVal;
1020  }
1021  }
1022 
1023 
1024 /* All fids above 10 are autoclosed in the exec file because we have used
1025  * the O_NOINHERIT flag. Note I patched open.obj to pass this flag to the
1026  * open function.
1027  */
1028 
1029  if (t->type == TPAREN)
1030  return RestoreStandardIO (ExecuteParseTree (t->left, NOPIPE, NOPIPE, 0),
1031  TRUE);
1032 
1033 /* Are we just changing the I/O re-direction for the shell ? */
1034 
1035  if (*AList == NOWORD)
1036  {
1037  if ((ForkAction & EXEC_WITHOUT_FORK) == 0)
1038  RestoreStandardIO (0, TRUE);
1039 
1040 /* Get the status variable if expand changed it */
1041 
1042  return (int)GetVariableAsNumeric (StatusVariable);
1043  }
1044 
1045 /*
1046  * Find the end of the parameters and set up $_ environment variable
1047  */
1048 
1049  alp = AList;
1050  while (*alp != NOWORD)
1051  alp++;
1052 
1053 /* Move back to last parameter, and save it */
1054 
1055  *LastWord = StringCopy (*(alp - 1));
1056 
1057 /* No - Check for a function the program. At this point, we need to put
1058  * in some processing for return.
1059  */
1060 
1061  if (!(builtin & BLT_CURRENT) &&
1062  ExecuteFunction (AList, &RetVal, CGVLCalled))
1063  return RetVal;
1064 
1065 /* Check for another drive or directory in the restricted shell */
1066 
1067  if ((strpbrk (*AList, ":/\\") != (char *)NULL) &&
1068  CheckForRestrictedShell (*AList))
1069  return RestoreStandardIO (-1, TRUE);
1070 
1071 /* A little cheat to allow us to use the same code to start OS/2 sessions
1072  * as to load and execute a program
1073  */
1074 
1075 #if (OS_TYPE == OS_OS2)
1076  SessionControlBlock = (STARTDATA *)NULL;
1077 #endif
1078 
1079 /* Ok - execute the program */
1080 
1081  if (!(builtin & BLT_CURRENT))
1082  {
1083  RetVal = EnvironExecute (AList, ForkAction);
1084 
1085 
1087  RetVal = LocalExecve (AList, BuildCommandEnvironment (),
1088  ForkAction);
1089  }
1090 
1091 /* If we didn't find it, check for internal command
1092  *
1093  * Note that the exec command is a special case
1094  */
1095 
1096  if ((builtin & BLT_CURRENT) || ((RetVal == -1) && (errno == ENOENT)))
1097  {
1098  if (shcom != (int (*)(int, char **))NULL)
1099  {
1100  if (InternalExec)
1101  RetVal = doexec (t);
1102 
1103  else
1104  RetVal = (*shcom)(CountNumberArguments (AList), AList);
1105 
1106  SetCommandReturnStatus (RetVal);
1107  }
1108  }
1109 
1110  if (RetVal == -1)
1111  PrintLoadError (*AList);
1112 
1113  return RestoreStandardIO (RetVal, TRUE);
1114 }
1115 
1116 /*
1117  * Restore Local Environment
1118  */
1119 
1120 void RestoreEnvironment (int retval, int stack)
1121 {
1126 }
1127 
1128 /*
1129  * Set up I/O redirection. 0< 1> are ignored as required within pipelines.
1130  */
1131 
1133  int pipein,
1134  int pipeout)
1135 {
1136  int u;
1137  char *cp, *msg;
1138 
1139 /* Check for pipes */
1140 
1141  if ((pipein != NOPIPE) && (iop->io_unit == STDIN_FILENO))
1142  return FALSE;
1143 
1144  if ((pipeout != NOPIPE) && (iop->io_unit == STDOUT_FILENO))
1145  return FALSE;
1146 
1147  msg = ((iop->io_flag & IOTYPE) == IOWRITE) ? "create" : "open";
1148 
1149  if ((iop->io_flag & IOTYPE) != IOHERE)
1152 
1153 /*
1154  * Duplicate - check for close
1155  */
1156 
1157  if ((iop->io_flag & IOTYPE) == IODUP)
1158  {
1159  if ((cp[1]) || (!isdigit (*cp) && (*cp != CHAR_CLOSE_FD)))
1160  {
1161  ShellErrorMessage ("illegal >& argument (%s)", cp);
1162  return TRUE;
1163  }
1164 
1165  if (*cp == CHAR_CLOSE_FD)
1166  {
1167  iop->io_flag &= ~~IOTYPE;
1168  iop->io_flag |= IOCLOSE;
1169  }
1170  }
1171 
1172 /*
1173  * When writing to /dev/???, we have to cheat because MSDOS appears to
1174  * have a problem with /dev/ files after find_first/find_next.
1175  */
1176 
1177 #if (OS_TYPE != OS_UNIX)
1178  if (((iop->io_flag & IOTYPE) == IOWRITE) &&
1180  {
1181  iop->io_flag &= ~~IOTYPE;
1182  iop->io_flag |= IOCAT;
1183  }
1184 #endif
1185 
1186 /* Open the file in the appropriate mode */
1187 
1188  switch (iop->io_flag & IOTYPE)
1189  {
1190  case IOREAD: /* < */
1191  u = S_open (FALSE, cp, O_RDONLY);
1192  break;
1193 
1194  case IOHERE: /* << */
1195  u = OpenHereFile (iop->io_name, C2bool (iop->io_flag & IOEVAL));
1196  cp = "here file";
1197  break;
1198 
1199  case IORDWR: /* <> */
1201  return TRUE;
1202 
1203  u = S_open (FALSE, cp, O_RDWR);
1204  break;
1205 
1206  case IOCAT: /* >> */
1208  return TRUE;
1209 
1210  if ((u = S_open (FALSE, cp, O_WRONLY | O_BINARY)) >= 0)
1211  {
1212  lseek (u, 0L, SEEK_END);
1213  break;
1214  }
1215 
1216  case IOWRITE: /* > */
1218  return TRUE;
1219 
1220  if ((ShellGlobalFlags & FLAGS_NOCLOBER) &&
1221  (!(iop->io_flag & IOCLOBBER)) &&
1223  {
1224  u = -1;
1225  break;
1226  }
1227 
1228  u = S_open (FALSE, cp, O_CMASK);
1229  break;
1230 
1231  case IODUP: /* >& */
1233  return TRUE;
1234 
1235  u = S_dup2 (*cp - '0', iop->io_unit);
1236  break;
1237 
1238  case IOCLOSE: /* >- */
1239  if ((iop->io_unit >= STDIN_FILENO) &&
1240  (iop->io_unit <= STDERR_FILENO))
1241  S_dup2 (-1, iop->io_unit);
1242 
1243  S_close (iop->io_unit, TRUE);
1244  return FALSE;
1245  }
1246 
1247  if (u < 0)
1248  {
1249  PrintWarningMessage (LIT_3Strings, cp, "cannot ", msg);
1250  return TRUE;
1251  }
1252 
1253  else if (u != iop->io_unit)
1254  {
1255  S_dup2 (u, iop->io_unit);
1256  S_close (u, TRUE);
1257  }
1258 
1259  return FALSE;
1260 }
1261 
1262 /*
1263  * -x flag - echo command to be executed
1264  */
1265 
1266 static void F_LOCAL EchoCurrentCommand (char **wp)
1267 {
1268  int i;
1269 
1271  fprintf (stderr, "%s:", CurrentFunction->tree->str);
1272 
1274 
1275  for (i = 0; wp[i] != NOWORD; i++)
1276  {
1277  if (i)
1278  feputc (CHAR_SPACE);
1279 
1280  feputs (wp[i]);
1281  }
1282 
1284 }
1285 
1286 /*
1287  * Set up the status on exit from a command
1288  */
1289 
1291 {
1293  return s;
1294 }
1295 
1296 /*
1297  * Execute a command
1298  */
1299 
1300 int ExecuteACommand (char **argv, int mode)
1301 {
1302  int RetVal;
1303 
1305  RetVal = EnvironExecute (argv, 0);
1306 
1308  RetVal = LocalExecve (argv, BuildCommandEnvironment (), mode);
1309 
1310  return RetVal;
1311 }
1312 
1313 /*
1314  * PATH-searching interface to execve.
1315  */
1316 
1317 static int F_LOCAL LocalExecve (char **argv, char **envp, int ForkAction)
1318 {
1319  int res = -1; /* Result */
1320  char *p_name; /* Program name */
1321  int i;
1322 
1323 /* Clear the DosExec Failname field */
1324 
1325 #if (OS_TYPE == OS_OS2)
1326  *FailName = 0;
1327 #endif
1328 
1329 #if (OS_TYPE != OS_DOS)
1330  OS_DosExecPgmReturnCode = 0;
1331 #endif
1332 
1333 /* If the environment is null - It is too big - error */
1334 
1335  if (envp == NOWORDS)
1336  errno = E2BIG;
1337 
1338  else if ((p_name = AllocateMemoryCell (FFNAME_MAX)) == (char *)NULL)
1339  errno = ENOMEM;
1340 
1341  else
1342  {
1343 /* Start off on the search path for the executable file */
1344 
1345  switch (i = FindLocationOfExecutable (p_name, argv[0]))
1346  {
1347  case EXTENSION_EXECUTABLE:
1348  res = ExecuteProgram (p_name, argv, envp, ForkAction);
1349  break;
1350 
1351 /* Script file */
1352 
1353  case EXTENSION_BATCH:
1355  res = ExecuteScriptFile (p_name, argv, envp, ForkAction,
1356  (bool)(i == EXTENSION_SHELL_SCRIPT));
1357  break;
1358  }
1359 
1360  if (res != -1)
1361  {
1362  TrackAllCommands (p_name, *argv);
1363  return res;
1364  }
1365  }
1366 
1367 /* If no fork - exit */
1368 
1369  if (ForkAction & EXEC_WITHOUT_FORK)
1370  {
1371  PrintLoadError (*argv);
1372  FinalExitCleanUp (-1);
1373  }
1374 
1375  return -1;
1376 }
1377 
1378 /*
1379  * Exec or spawn the program ?
1380  */
1381 
1382 static int F_LOCAL ExecuteProgram (char *path,
1383  char **parms,
1384  char **envp,
1385  int ForkAction)
1386 {
1387  int res;
1388 #ifdef OS_SWAPPING
1389  char *ep;
1390  unsigned int size = 0;
1391  int serrno;
1392  unsigned int c_cur = (unsigned int)(_psp - 1);
1393  struct MCB_list *mp = (struct MCB_list *)((unsigned long)c_cur << 16L);
1394 #endif
1395 
1396 /* Check we have access to the file */
1397 
1398  if (!S_access (path, F_OK))
1399  return SetCommandReturnStatus (-1);
1400 
1401 /* Process the command line. If no swapping, we have executed the program */
1402 
1403  res = BuildCommandLine (path, parms, envp, ForkAction);
1404 
1405 #if (OS_TYPE != OS_DOS) || (OS_SIZE == OS_32)
1406  SetWindowName ((char *)NULL);
1408  return SetCommandReturnStatus (res);
1409 
1410 #else
1412  res)
1413  {
1415  return SetCommandReturnStatus (res);
1416  }
1417 
1418 /* Find the length of the swap area */
1419 
1420  while ((mp = (struct MCB_list *)((unsigned long)c_cur << 16L))->MCB_type
1421  == MCB_CON)
1422  {
1423  if (c_cur >= 0x9ffe)
1424  break;
1425 
1426  if ((mp->MCB_pid != _psp) && (mp->MCB_pid != 0) &&
1427  (mp->MCB_type != MCB_END))
1428  {
1430  PrintErrorMessage ("Fatal: Memory chain corrupt");
1431  return SetCommandReturnStatus (-1);
1432  }
1433 
1434  c_cur += (mp->MCB_len + 1);
1435  size += mp->MCB_len + 1;
1436  }
1437 
1438 /*
1439  * Convert swap size from paragraphs to 16K blocks.
1440  */
1441 
1442  if (size == 0)
1443  size = mp->MCB_len + 1;
1444 
1445  SW_Blocks = (size / 0x0400) + 1;
1446  SW_SBlocks = ((size - etext + _psp - 1) / 0x0400) + 1;
1447 
1448 /*
1449  * Minimum Environment space
1450  */
1451 
1452  SW_MinESpace = (unsigned int)GetVariableAsNumeric ("ENVIRONMENTSPACE");
1453 
1454 /* OK Now we've set up the FCB's, command line and opened the swap file.
1455  * Get some sys info for the swapper and execute my little assembler
1456  * function to swap us out
1457  */
1458 
1459 /* Ok - 3 methods of swapping. Set up the program to execute */
1460 
1461  strcpy (path_line, path);
1462 
1463 /* If expanded memory - try that */
1464 
1465  if ((Swap_Mode & SWAP_EXPAND) && Get_EMS_Driver ())
1466  {
1467  SW_Mode = 3; /* Set Expanded memory swap */
1468 
1469  if ((res = SwapToMemory (SWAP_EXPAND, envp)) != -2)
1470  return CheckForExecOnly (*parms, res,
1471  (ForkAction & EXEC_WITHOUT_FORK));
1472  }
1473 
1474  if ((Swap_Mode & SWAP_EXTEND) && Get_XMS_Driver ())
1475  {
1476  SW_Mode = (SW_fp == -1) ? 2 : 4;/* Set Extended memory or XMS driver */
1477 
1478  if ((res = SwapToMemory (SWAP_EXTEND, envp)) != -2)
1479  return CheckForExecOnly (*parms, res,
1480  (ForkAction & EXEC_WITHOUT_FORK));
1481 
1482  Swap_Mode &= ~~SWAP_EXTEND;
1483  }
1484 
1485 /* Try the disk if available */
1486 
1487  if (Swap_Mode & SWAP_DISK)
1488  {
1489  SW_Pwrite = 0;
1490 
1491  if (Swap_File == (char *)NULL)
1493  O_SMASK);
1494 
1495  else
1496  {
1498  SW_Pwrite = 1;
1499  }
1500 
1501  if (SW_fp < 0)
1502  return SwapToDiskError (ENOSPC, NoSwapFiles);
1503 
1504 /* Save the swap file name ? */
1505 
1506  if ((Swap_File == (char *)NULL) &&
1507  ((Swap_File = StringSave (ep)) == null))
1508  Swap_File = (char *)NULL;
1509 
1510  SW_Mode = 1; /* Set Disk file swap */
1511 
1512 /* Seek to correct location */
1513 
1514  if (SW_Pwrite)
1515  {
1516  long loc = (long)(etext - _psp + 1) * 16L;
1517 
1518  if (lseek (SW_fp, loc, SEEK_SET) != loc)
1519  return SwapToDiskError (ENOSPC, NoSwapFiles);
1520  }
1521 
1522 /* Execute the program */
1523 
1524  res = SpawnProcess (envp);
1525 
1526 /* Close the extended command line file */
1527 
1529 
1530 /* Check for out of swap space */
1531 
1532  if (res == -2)
1533  {
1534  SwapToDiskError (errno, "Swap file write failed");
1535  return CheckForExecOnly (*parms, res,
1536  (ForkAction & EXEC_WITHOUT_FORK));
1537  }
1538 
1539 /* Close the swap file */
1540 
1541  serrno = errno;
1542  S_close (SW_fp, TRUE);
1543  errno = serrno;
1544 
1545 /* Return the result */
1546 
1547  return CheckForExecOnly (*parms, SetCommandReturnStatus (res),
1548  (ForkAction & EXEC_WITHOUT_FORK));
1549  }
1550 
1551 /* No swapping available - give up */
1552 
1554  PrintErrorMessage ("All Swapping methods failed");
1555  Swap_Mode = SWAP_OFF;
1556  errno = ENOSPC;
1557  return SetCommandReturnStatus (-1);
1558 #endif
1559 }
1560 
1561 /*
1562  * OS2 and WinNT and DOS 32 do not require swapping
1563  *
1564  * Check for Exec only. We check on exec and do a spawn and then exit
1565  * to solve some memory allocation problems and because I can't be bothered
1566  * with complexities of doing an exec in sh0.asm.
1567  */
1568 
1569 #ifdef OS_SWAPPING
1570 static int F_LOCAL CheckForExecOnly (char *pgm, int res, int ExecMode)
1571 {
1572  if (ExecMode)
1573  {
1574  if (res >= 0)
1575  FinalExitCleanUp (0);
1576 
1577  PrintLoadError (pgm);
1578  FinalExitCleanUp (-1);
1579  }
1580 
1581 /* Convert swap error to general error */
1582 
1583  else if (res == -2)
1584  res = -1;
1585 
1586  return res;
1587 }
1588 
1589 /*
1590  * Get the XMS Driver information
1591  */
1592 
1593 static bool F_LOCAL Get_XMS_Driver (void)
1594 {
1595  union REGS or;
1596  struct SREGS sr;
1597  unsigned int SW_EMsize; /* Number of extend memory blks */
1598 
1599 /* Get max Extended memory pages, and convert to 16K blocks. If Extended
1600  * memory swapping disabled, set to zero
1601  */
1602 
1603  SW_fp = -1; /* Set EMS/XMS handler not */
1604  /* defined */
1605 
1606 /* Is a XMS memory driver installed */
1607 
1608  or.x.REG_AX = 0x4300;
1609  SystemInterrupt (0x2f, &or, &or);
1610 
1611  if (or.h.al != 0x80)
1612  {
1613  or.x.REG_AX = 0x8800;
1614  SystemInterrupt (0x15, &or, &or);
1615  SW_EMsize = or.x.REG_AX / 16;
1616 
1617  if ((SW_EMsize <= SW_Blocks) ||
1618  (((long)(SW_EMstart - 0x100000L) +
1619  ((long)(SW_Blocks - SW_EMsize) * 16L * 1024L)) < 0L))
1620  return XMS_error (MS_Space, 0);
1621 
1622  else
1623  return TRUE;
1624  }
1625 
1626 /* Get the driver interface */
1627 
1628  or.x.REG_AX = 0x4310;
1629  SystemExtendedInterrupt (0x2f, &or, &or, &sr);
1630  SW_XMS_Driver = (unsigned long)((unsigned long)(sr.es) << 16L |
1631  (unsigned long)(or.x.REG_BX));
1632 
1633 /* Support for version 3 of XMS driver */
1634 
1635  if ((SW_XMS_Gversion () & 0xff00) < 0x0200)
1636  return !FL_TEST (FLAG_WARNING)
1637  ? XMS_error ("Warning: %s Version < 2", 0) : FALSE;
1638 
1639  else if (SW_XMS_Available () < (SW_Blocks * 16))
1640  return !FL_TEST (FLAG_WARNING) ? XMS_error (MS_Space, 0) : FALSE;
1641 
1642  else if ((SW_fp = SW_XMS_Allocate (SW_Blocks * 16)) == -1)
1643  return XMS_error (MS_emsg, errno);
1644 
1645  return TRUE;
1646 }
1647 
1648 /* Get the EMS Driver information */
1649 
1650 static bool F_LOCAL Get_EMS_Driver (void)
1651 {
1652  union REGS or;
1653  struct SREGS sr;
1654  char *sp;
1655 
1656 /* Set EMS/XMS handler not defined */
1657 
1658  SW_fp = -1;
1659 
1660  or.x.REG_AX = 0x3567;
1661  DosExtendedInterrupt (&or, &or, &sr);
1662 
1663  sp = (char *)((unsigned long)(sr.es) << 16L | 10L);
1664 
1665 /* If not there - disable */
1666 
1667  if (memcmp ("EMMXXXX0", sp, 8) != 0)
1668  return !FL_TEST (FLAG_WARNING)
1669  ? EMS_error ("Warning: %s not available", 0) : FALSE;
1670 
1671  or.h.ah = 0x40; /* Check status */
1672  SystemInterrupt (0x67, &or, &or);
1673 
1674  if (or.h.ah != 0)
1675  return EMS_error (MS_emsg, or.h.ah);
1676 
1677 /* Check version greater than 3.2 */
1678 
1679  or.h.ah = 0x46;
1680  SystemInterrupt (0x67, &or, &or);
1681 
1682  if ((or.h.ah != 0) || (or.h.al < 0x32))
1683  return !FL_TEST (FLAG_WARNING)
1684  ? EMS_error ("Warning: %s Version < 3.2", 0) : FALSE;
1685 
1686 /* get page frame address */
1687 
1688  or.h.ah = 0x41;
1689  SystemInterrupt (0x67, &or, &or);
1690 
1691  if (or.h.ah != 0)
1692  return EMS_error (MS_emsg, or.h.ah);
1693 
1694  SW_EMSFrame = or.x.REG_BX; /* Save the page frame */
1695 
1696 /* Get the number of pages required */
1697 
1698  or.h.ah = 0x43;
1699  or.x.REG_BX = SW_Blocks;
1700  SystemInterrupt (0x67, &or, &or);
1701 
1702  if (or.h.ah == 0x088)
1703  return EMS_error (MS_Space, 0);
1704 
1705  if (or.h.ah != 0)
1706  return EMS_error (MS_emsg, or.h.ah);
1707 
1708 /* Save the EMS Handler */
1709 
1710  SW_fp = or.x.REG_DX;
1711 
1712 /* save EMS page map */
1713 
1714  or.h.ah = 0x47;
1715  or.x.REG_DX = SW_fp;
1716  SystemInterrupt (0x67, &or, &or);
1717 
1718  return (or.h.ah != 0) ? EMS_error (MS_emsg, or.h.ah) : TRUE;
1719 }
1720 
1721 /* Print EMS error message */
1722 
1723 static bool F_LOCAL EMS_error (char *s, int v)
1724 {
1725  PrintWarningMessage (s, "EMS", v);
1726  Swap_Mode &= ~(SWAP_EXPAND);
1727  EMS_Close ();
1728  return FALSE;
1729 }
1730 
1731 /* Print XMS error message */
1732 
1733 static bool F_LOCAL XMS_error (char *s, int v)
1734 {
1735  PrintWarningMessage (s, "XMS", v);
1736  Swap_Mode &= ~(SWAP_EXTEND);
1737  XMS_Close ();
1738  return FALSE;
1739 }
1740 
1741 /* If the XMS handler is defined - close it */
1742 
1743 static int F_LOCAL XMS_Close (void)
1744 {
1745  int res = 0;
1746 
1747 /* Release XMS page */
1748 
1749  if (SW_fp != -1)
1750  res = SW_XMS_Free (SW_fp);
1751 
1752  SW_fp = -1;
1753  return res;
1754 }
1755 
1756 /* If the EMS handler is defined - close it */
1757 
1758 static int F_LOCAL EMS_Close (void)
1759 {
1760  union REGS or;
1761  int res = 0;
1762 
1763  if (SW_fp == -1)
1764  return 0;
1765 
1766 /* Restore EMS page */
1767 
1768  or.h.ah = 0x48;
1769  or.x.REG_DX = SW_fp;
1770  SystemInterrupt (0x67, &or, &or);
1771 
1772  if (or.h.ah != 0)
1773  res = or.h.al;
1774 
1775  or.h.ah = 0x45;
1776  or.x.REG_DX = SW_fp;
1777  SystemInterrupt (0x67, &or, &or);
1778 
1779  SW_fp = -1;
1780  return (res) ? res : or.h.ah;
1781 }
1782 #endif
1783 
1784 /* Set up command line. If the EXTENDED_LINE variable is set, we create
1785  * a temporary file, write the argument list (one entry per line) to the
1786  * this file and set the command line to @<filename>. If NOSWAPPING, we
1787  * execute the program because I have to modify the argument line
1788  */
1789 
1790 static int F_LOCAL BuildCommandLine (char *path,
1791  char **argv,
1792  char **envp,
1793  int ForkAction)
1794 {
1795  char **pl = argv;
1796  FILE *fd;
1797  bool found;
1798  char *new_args[3];
1799 #ifndef OS_SWAPPING
1800  char cmd_line[FFNAME_MAX];
1801 #endif
1802 
1803 /* Translate process name to MSDOS format */
1804 
1805  if ((GenerateFullExecutablePath (path) == (char *)NULL) ||
1806  (!GetApplicationType (path)))
1807  return -1;
1808 
1809 /* If this is a windows program - special */
1810 
1811 #if (OS_TYPE != OS_UNIX)
1813  return ExecuteWindows (path, argv, envp, ForkAction);
1814 #endif
1815 
1816 /* Extended command line processing */
1817 
1818  Extend_file = (char *)NULL; /* Set no file */
1821 
1822 /* Set up a blank command line */
1823 
1824  cmd_line[0] = 0;
1825  cmd_line[1] = CHAR_RETURN;
1826 
1827 /* If there are no parameters, or they fit in the DOS command line
1828  * - start the process */
1829 
1830  if ((*(++pl) == (char *)NULL) || CheckParameterLength (pl))
1831  {
1832  return StartTheProcess (path, argv, envp, ForkAction);
1833  }
1834 
1835 /* If we can use an alternative approach - indirect files, use it */
1836 
1837  else if (found)
1838  {
1839  char **pl1 = pl;
1840 
1841 /* Check parameters don't contain a re-direction parameter */
1842 
1843  while (*pl1 != NOWORD)
1844  {
1845  if (**(pl1++) == CHAR_INDIRECT)
1846  {
1847  found = FALSE;
1848  break;
1849  }
1850  }
1851 
1852 /* If we find it - create a temporary file and write the stuff */
1853 
1854  if ((found) &&
1856  sOpenWriteMode)) != (FILE *)NULL))
1857  {
1858  if ((Extend_file = StringSave (Extend_file)) == null)
1859  Extend_file = (char *)NULL;
1860 
1861 /* Copy to end of list */
1862 
1863  do
1864  {
1865  if (!WriteToExtendedFile (fd, *pl))
1866  return -1;
1867  } while (*(pl++) != NOWORD);
1868 
1869 /* Set up cmd_line[1] to contain the filename */
1870 
1871 #ifdef OS_SWAPPING
1873 #else
1874  memset (cmd_line, 0, FFNAME_MAX);
1875 #endif
1876  cmd_line[1] = CHAR_SPACE;
1877  cmd_line[2] = CHAR_INDIRECT;
1878  strcpy (&cmd_line[3], Extend_file);
1879  cmd_line[0] = (char)(strlen (Extend_file) + 2);
1880 
1881 /* Correctly terminate cmd_line in no swap mode */
1882 
1883 #ifdef OS_SWAPPING
1884  if (!(ExecProcessingMode.Flags & EP_NOSWAP) &&
1885  (Swap_Mode != SWAP_OFF))
1886  cmd_line[cmd_line[0] + 2] = CHAR_RETURN;
1887 #endif
1888 
1889 /* If the name in the file is in upper case - use \ for separators */
1890 
1892  PATH_TO_DOS (&cmd_line[2]);
1893 
1894 /* OK we are ready to execute */
1895 
1896 #ifdef OS_SWAPPING
1898  (Swap_Mode == SWAP_OFF) || (ForkAction & EXEC_WITHOUT_FORK))
1899  {
1900 #endif
1901  new_args[0] = *argv;
1902  new_args[1] = &cmd_line[2];
1903  new_args[2] = (char *)NULL;
1904 
1905  return StartTheProcess (path, new_args, envp, ForkAction);
1906 #ifdef OS_SWAPPING
1907  }
1908 
1909  else
1910  return 0;
1911 #endif
1912  }
1913  }
1914 
1915  return -1;
1916 }
1917 
1918 /*
1919  * Clear Extended command line file
1920  */
1921 
1923 {
1924  if (Extend_file != (char *)NULL)
1925  {
1926  unlink (Extend_file);
1927  ReleaseMemoryCell ((void *)Extend_file);
1928  }
1929 
1930  Extend_file = (char *)NULL;
1931 }
1932 
1933 /*
1934  * Clear Disk swap file file
1935  */
1936 
1937 #ifdef OS_SWAPPING
1938 void ClearSwapFile (void)
1939 {
1940  if (SW_fp >= 0)
1941  S_close (SW_fp, TRUE);
1942 
1943  if (Swap_File != (char *)NULL)
1944  {
1945  unlink (Swap_File);
1946  ReleaseMemoryCell ((void *)Swap_File);
1947  }
1948 
1949  SW_fp = -1;
1950  Swap_File = (char *)NULL;
1951 }
1952 #endif
1953 
1954 /*
1955  * Convert the executable path to the full path name
1956  */
1957 
1959 {
1960  char cpath[PATH_MAX + 6];
1961  char npath[FFNAME_MAX + 2];
1962  char n1path[PATH_MAX + 6];
1963  char *p;
1964  int drive;
1965 
1967 
1968 /* Get the current path */
1969 
1970  S_getcwd (cpath, 0);
1971  strcpy (npath, cpath);
1972 
1973 /* In current directory ? */
1974 
1975  if ((p = FindLastPathCharacter (path)) == (char *)NULL)
1976  {
1977  p = path;
1978 
1979 /* Check for a:program case */
1980 
1981  if (IsDriveCharacter (*(p + 1)))
1982  {
1983  p += 2;
1984 
1985 /* Get the path of the other drive */
1986 
1987  S_getcwd (npath, GetDriveNumber (*path));
1988  }
1989  }
1990 
1991 /* In root directory */
1992 
1993  else if ((p - path) == 0)
1994  {
1995  ++p;
1996  strcpy (npath, RootDirectory);
1997  *npath = *path;
1998  *npath = *cpath;
1999  }
2000 
2001  else if (((p - path) == 2) && IsDriveCharacter (*(path + 1)))
2002  {
2003  ++p;
2004  strcpy (npath, RootDirectory);
2005  *npath = *path;
2006  }
2007 
2008 /* Find the directory */
2009 
2010  else
2011  {
2012  *(p++) = 0;
2013 
2014 /* Change to the directory containing the executable */
2015 
2016  drive = IsDriveCharacter (*(path + 1))
2017  ? GetDriveNumber (*path)
2018 #if (OS_TYPE == OS_OS2) && !defined (__WATCOMC__)
2019  : _getdrive ();
2020 #else
2021  : 0;
2022 #endif
2023 
2024 /* Save the current directory on this drive */
2025 
2026  S_getcwd (n1path, drive);
2027 
2028 /* Find the directory we want */
2029 
2030  if (!S_chdir (path))
2031  return (char *)NULL;
2032 
2033  S_getcwd (npath, drive); /* Save its full name */
2034  S_chdir (n1path); /* Restore the original */
2035 
2036 /* Restore our original directory */
2037 
2038  if (!S_chdir (cpath))
2039  return (char *)NULL;
2040  }
2041 
2042  if (!IsPathCharacter (npath[strlen (npath) - 1]))
2043  strcat (npath, DirectorySeparator);
2044 
2045  strcat (npath, p);
2046  return PATH_TO_DOS (strcpy (path, npath));
2047 }
2048 
2049 /*
2050  * Find the number of values to use for a for or select statement
2051  */
2052 
2053 static char ** F_LOCAL FindNumberOfValues (char **wp, int *Count)
2054 {
2055 
2056 /* select/for x do...done - use the parameter values. Need to know how many as
2057  * it is not a NULL terminated array
2058  */
2059 
2060  if (wp == NOWORDS)
2061  {
2062  if ((*Count = ParameterCount) < 0)
2063  *Count = 0;
2064 
2065  return ParameterArray + 1;
2066  }
2067 
2068 /* select/for x in y do...done - find the start of the variables and
2069  * use them all
2070  */
2071 
2072  *Count = CountNumberArguments (wp);
2073 
2074  return wp;
2075 }
2076 
2077 /*
2078  * Count the number of entries in an array
2079  */
2080 
2081 int CountNumberArguments (char **wp)
2082 {
2083  int Count = 0;
2084 
2085  while (*(wp++) != NOWORD)
2086  Count++;
2087 
2088  return Count;
2089 }
2090 
2091 /*
2092  * Write a command string to the extended file
2093  */
2094 
2095 static bool F_LOCAL WriteToExtendedFile (FILE *fd, char *string)
2096 {
2097  char *sp = string;
2098  char *cp = string;
2099  bool WriteOk = TRUE;
2100 
2101  if (string == (char *)NULL)
2102  {
2103  if (CloseFile (fd) != EOF)
2104  return TRUE;
2105 
2106  WriteOk = FALSE;
2107  }
2108 
2109  else if (strlen (string))
2110  {
2111 
2112 /* Write the string, converting newlines to backslash newline */
2113 
2114  while (WriteOk && (cp != (char *)NULL))
2115  {
2116  if ((cp = strchr (sp, CHAR_NEW_LINE)) != (char *)NULL)
2117  *cp = 0;
2118 
2119  if (fputs (sp, fd) == EOF)
2120  WriteOk = FALSE;
2121 
2122  else if (cp != (char *)NULL)
2123  WriteOk = C2bool (fputs ("\\\n", fd) != EOF);
2124 
2125  sp = cp + 1;
2126  }
2127  }
2128 
2129  if (WriteOk && (fputc (CHAR_NEW_LINE, fd) != EOF))
2130  return TRUE;
2131 
2132  CloseFile (fd);
2134  errno = ENOSPC;
2135  return FALSE;
2136 }
2137 
2138 /*
2139  * Execute or spawn the process
2140  */
2141 
2142 #ifdef OS_SWAPPING
2143 static int F_LOCAL StartTheProcess (char *path, char **argv, char **envp,
2144  int ForkAction)
2145 {
2146  if (ForkAction & EXEC_WITHOUT_FORK)
2147  {
2148  DumpHistory (); /* Exec - save history */
2150  return 0;
2151  }
2152 
2153  return ((ExecProcessingMode.Flags & EP_NOSWAP) || (Swap_Mode == SWAP_OFF))
2154  ? spawnve (P_WAIT, path, ProcessSpaceInParameters (argv), envp)
2155  : 0;
2156 }
2157 #endif
2158 
2159 /* DOS, 32 bit version */
2160 
2161 #if (OS_TYPE == OS_DOS) && (OS_SIZE == OS_32)
2162 static int F_LOCAL StartTheProcess (char *path, char **argv, char **envp,
2163  int ForkAction)
2164 {
2165  int retval;
2166 
2167  if (ForkAction & EXEC_WITHOUT_FORK)
2168  {
2169  DumpHistory (); /* Exec - save history */
2170 
2171  if ((retval = spawnve (P_WAIT, path, ProcessSpaceInParameters (argv),
2172  envp)) != -1)
2173  exit (retval);
2174 
2175  PrintErrorMessage ("unexpected return from exec (%d)", errno);
2176  return retval;
2177  }
2178 
2179  return spawnve (P_WAIT, path, ProcessSpaceInParameters (argv), envp);
2180 }
2181 #endif
2182 
2183 /* OS/2 Version */
2184 
2185 #if (OS_TYPE == OS_OS2)
2186 static int F_LOCAL StartTheProcess (char *path, char **argv, char **envp,
2187  int ForkAction)
2188 {
2189  int RetVal;
2190  STARTDATA stdata;
2191 
2192 /* Is this a start session option */
2193 
2194  if (SessionControlBlock != (STARTDATA *)NULL)
2195  return StartTheSession (SessionControlBlock, path, argv, envp,
2196  ForkAction);
2197 
2198 /* Exec ? */
2199 
2200  if (ForkAction & EXEC_WITHOUT_FORK)
2201  return OS_DosExecProgram (OLD_P_OVERLAY, path, argv, envp);
2202 
2203  if (ForkAction & (EXEC_SPAWN_DETACH | EXEC_SPAWN_NOWAIT |
2204  EXEC_SPAWN_IGNOREWAIT))
2205  {
2206  int Mode = (ForkAction & EXEC_SPAWN_DETACH)
2207  ? P_DETACH
2208  : ((ForkAction & EXEC_SPAWN_IGNOREWAIT)
2209  ? P_NOWAITO
2211  ? P_DETACH
2212  : P_NOWAIT));
2213 
2214  RetVal = OS_DosExecProgram (Mode, path, argv, envp);
2215 
2216 /* Remove the reference to the temporary file for background tasks */
2217 
2218  ReleaseMemoryCell ((void *)Extend_file);
2219  Extend_file = (char *)NULL;
2220 
2221  if ((RetVal != -1) && (Mode != P_NOWAITO))
2222  {
2223  if (InteractiveFlag && (source->type == STTY))
2224  {
2225  if (ForkAction & EXEC_SPAWN_DETACH)
2226  fprintf (stderr, "[0] Process %d detached\n", RetVal);
2227 
2228  else
2229  {
2230  PidInfo.Valid = TRUE;
2231  PidInfo.JobNo = AddNewJob (RetVal, 0, path);
2232  PidInfo.PidNo = RetVal;
2233  }
2234  }
2235 
2236  SetVariableFromNumeric ("!", RetVal);
2237  return 0;
2238  }
2239 
2240  return RetVal;
2241  }
2242 
2243 /* In OS/2, we need the type of the program because PM programs have to be
2244  * started in a session (or at least that was the only way I could get them
2245  * to work).
2246  */
2247 
2248 /* Do we need to start a new session for this program ? */
2249 
2252  {
2253  if ((OS_VERS_N > 1) && (ApplicationType & EXETYPE_DOS))
2254  memcpy (&stdata, &DOS_SessionControlBlock, sizeof (STARTDATA));
2255 
2256  else
2257  memcpy (&stdata, &PM_SessionControlBlock, sizeof (STARTDATA));
2258 
2259  if (ForkAction & EXEC_WINDOWS)
2260  stdata.PgmControl = 0;
2261 
2262  return StartTheSession (&stdata, path, argv, envp, ForkAction);
2263  }
2264 
2265 /* Just DosExecPgm it */
2266 
2267  return OS_DosExecProgram (P_WAIT, path, argv, envp);
2268 }
2269 #endif
2270 
2271 /* NT Version */
2272 
2273 #if (OS_TYPE == OS_NT)
2274 static int F_LOCAL StartTheProcess (char *path, char **argv, char **envp,
2275  int ForkAction)
2276 {
2277  int RetVal;
2278 
2279 /* Exec ? */
2280 
2281  if (ForkAction & EXEC_WITHOUT_FORK)
2282  return OS_DosExecProgram (OLD_P_OVERLAY, path, argv, envp);
2283 
2284  if (ForkAction & (EXEC_SPAWN_DETACH | EXEC_SPAWN_NOWAIT |
2285  EXEC_SPAWN_IGNOREWAIT))
2286  {
2287  int Mode = (ForkAction & EXEC_SPAWN_DETACH)
2288  ? P_DETACH
2289  : ((ForkAction & EXEC_SPAWN_IGNOREWAIT)
2290  ? P_NOWAITO
2292  ? P_DETACH
2293  : P_NOWAIT));
2294 
2295  RetVal = OS_DosExecProgram (Mode, path, argv, envp);
2296 
2297 /* Remove the reference to the temporary file for background tasks */
2298 
2299  ReleaseMemoryCell ((void *)Extend_file);
2300  Extend_file = (char *)NULL;
2301 
2302  if ((RetVal != -1) && (Mode != P_NOWAITO))
2303  {
2304  if (InteractiveFlag && (source->type == STTY))
2305  {
2306  if (ForkAction & EXEC_SPAWN_DETACH)
2307  fprintf (stderr, "[0] Process %d detached\n", RetVal);
2308 
2309  else
2310  {
2311  PidInfo.Valid = TRUE;
2312  PidInfo.JobNo = AddNewJob (RetVal, 0, path);
2313  PidInfo.PidNo = RetVal;
2314  }
2315  }
2316 
2317  SetVariableFromNumeric ("!", RetVal);
2318  return 0;
2319  }
2320 
2321  else
2322  return RetVal;
2323  }
2324 
2325 /* Just DosExecPgm it */
2326 
2327  return OS_DosExecProgram (P_WAIT, path, argv, envp);
2328 }
2329 #endif
2330 
2331 /*
2332  * Start a session
2333  */
2334 
2335 #if (OS_TYPE == OS_OS2)
2336 static int F_LOCAL StartTheSession (STARTDATA *SessionData,
2337  char *path,
2338  char **argv,
2339  char **envp,
2340  int ForkAction)
2341 {
2342  OSCALL_PARAM usType;
2343  OSCALL_PARAM idSession;
2344 # if (OS_SIZE == OS_32)
2345  PID pid;
2346 # else
2347  USHORT pid;
2348 # endif
2349 
2350 /*
2351  * For OS/2 2.x, we can start DOS sessions!!
2352  */
2353 
2354  if ((OS_VERS_N > 1) && (ApplicationType & EXETYPE_DOS))
2355  {
2356  if ((ForkAction & EXEC_WINDOWS) ||
2357  (SessionData->SessionType == SSF_TYPE_FULLSCREEN))
2358  SessionData->SessionType = SSF_TYPE_VDM;
2359 
2360  else
2361  SessionData->SessionType = SSF_TYPE_WINDOWEDVDM;
2362 
2363  if (SessionData->Environment == (PBYTE)1)
2364  SessionData->Environment = (PBYTE)NULL;
2365  }
2366 
2368  SessionData->SessionType = SSF_TYPE_PM;
2369 
2370  SessionData->PgmName = path;
2371  SessionData->TermQ = SessionEndQName; /* Queue name */
2372 
2373  /*
2374  * Build the environment if the current value is 1
2375  */
2376 
2377  if ((SessionData->Environment == (PBYTE)1) &&
2378  ((SessionData->Environment = (PBYTE)BuildOS2String (envp, 0))
2379  == (PBYTE)NULL))
2380  return -1;
2381 
2383 
2384  if ((SessionData->PgmInputs = (PBYTE)BuildOS2String (&argv[1], CHAR_SPACE))
2385  == (PBYTE)NULL)
2386  return -1;
2387 
2388 /*
2389  * Start the session. Do not record if it is independent
2390  */
2391 
2393 # if (OS_SIZE == OS_16) && !defined (OS2_16_BUG)
2394  SessionData->Related = SSF_RELATED_INDEPENDENT;
2395 # endif
2396  usType = DosStartSession (SessionData, &idSession, &pid);
2398 
2399  if ((!usType) || (usType == ERROR_SMG_START_IN_BACKGROUND))
2400  {
2401  if (InteractiveFlag && (source->type == STTY))
2402  {
2403  if (SessionData->Related == SSF_RELATED_INDEPENDENT)
2404  fprintf (stderr, "[0] Independent Session %d started\n",
2405  idSession);
2406 
2407  else
2408  fprintf (stderr, "[%d] Session %d (PID %d) started\n",
2409  AddNewJob (pid, idSession, path), idSession, pid);
2410 
2411  if (usType)
2412  fprintf (stderr, "%s\n", GetOSSystemErrorMessage (usType));
2413  }
2414 
2415  SetVariableFromNumeric ("!", pid);
2416  return 0;
2417  }
2418 
2419  else
2420  {
2421  strcpy (FailName, GetOSSystemErrorMessage (usType));
2422 
2423  errno = ENOENT;
2424  return -1;
2425  }
2426 }
2427 #endif
2428 
2429 /*
2430  * Build the OS2 format <value>\0<value>\0 etc \0
2431  */
2432 
2433 char *BuildOS2String (char **Array, char sep)
2434 {
2435  int i = 0;
2436  int Length = 0;
2437  char *Output;
2438  char *sp, *cp;
2439 
2440 /* Find the total data length */
2441 
2442  while ((sp = Array[i++]) != NOWORD)
2443  Length += strlen (sp) + 1;
2444 
2445  Length += 2;
2446  Length += 2; /* --ak */
2447 
2448  if ((Output = AllocateMemoryCell (Length)) == (char *)NULL)
2449  return (char *)NULL;
2450 
2451 /* Build the new string */
2452 
2453  i = 0;
2454  sp = Output;
2455 
2456 /* Build the string */
2457 
2458 /* --ak */
2459 
2460  cp = Array[i++];
2461  {
2462  char *p;
2463  int pp = 0;
2464  if ((p = strchr(cp, ' ')) || (p = strchr(cp, '\t')))
2465  pp=1;
2466  if(pp)
2467  *sp++ = '"';
2468  while((*sp = *(cp++)))
2469  ++sp;
2470  if(pp)
2471  *sp++ = '"';
2472  }
2473  if(sep)
2474  *sp++ = sep;
2475 
2476 /* end --ak */
2477  while ((cp = Array[i++]) != NOWORD)
2478  {
2479  while ((*sp = *(cp++)))
2480  ++sp;
2481 
2482  if (!sep || (Array[i] != NOWORD))
2483  *(sp++) = sep;
2484  }
2485 
2486  *sp = 0;
2487  return Output;
2488 }
2489 
2490 
2491 /*
2492  * List of default known extensions and their type
2493  */
2494 
2495 #define MAX_DEFAULT_EXTENSIONS ARRAY_SIZE (DefaultExtensions)
2496 
2497 /* VBScript and JScript are executed by COMSPEC (A. Kakuto, 1998) */
2498 
2499 static struct ExtType {
2500  char *Extension;
2501  char Type;
2502 } DefaultExtensions [] = {
2503 #if (OS_TYPE != OS_UNIX)
2507 #endif
2508  { null, EXTENSION_SHELL_SCRIPT },
2511 #if (OS_TYPE == OS_UNIX) || (OS_TYPE == OS_NT)
2513 #if (OS_TYPE == OS_NT)
2519 #endif
2520 #endif
2521 };
2522 
2523 /*
2524  * Built the list of valid extensions
2525  */
2526 
2528 {
2529  Word_B *DList = (Word_B *)NULL;
2530  Word_B *FList = (Word_B *)NULL;
2531  int i;
2532  char *pe;
2533  char *sp;
2534  void (*save_signal)(int);
2535 
2536 /* Disable signals */
2537 
2538  save_signal = signal (SIGINT, SIG_IGN);
2539 
2540 /* Release Old memory */
2541 
2542  if (ExecuteFunctionList != (char **)NULL)
2543  {
2546  }
2547 
2548  if (ExecutableList != (char **)NULL)
2550 
2551 /* No extensions ? */
2552 
2553  if ((pe = GetVariableAsString (PathExtsLiteral, FALSE)) == null)
2554  {
2555  for (i = 0; i < MAX_DEFAULT_EXTENSIONS; i++)
2556  DList = AddWordToBlock (DefaultExtensions [i].Extension, DList);
2557 
2558  ExecutableList = GetWordList (AddWordToBlock ((char *)NULL, DList));
2559  ExecuteFunctionList = (char **)NULL;
2560 
2561 /* Restore signals */
2562 
2563  signal (SIGINT, save_signal);
2564 
2565  return;
2566  }
2567 
2568 /* OK - scan */
2569 
2570  pe = StringSave (pe);
2571 
2572 /* Split out on semi-colons */
2573 
2574  do
2575  {
2576  if ((sp = strchr (pe, ';')) != (char *)NULL)
2577  *(sp++) = 0;
2578 
2579  FList = AddWordToBlock (pe, FList);
2580 
2581 /* Build the new order of default extensions */
2582 
2583  for (i = 0; i < MAX_DEFAULT_EXTENSIONS; i++)
2584  {
2586  {
2587  DList = AddWordToBlock (pe, DList);
2588  break;
2589  }
2590  }
2591 
2592  pe = sp;
2593  } while (pe != (char *)NULL);
2594 
2595 /* Set up the two lists */
2596 
2597  ExecutableList = GetWordList (AddWordToBlock ((char *)NULL, DList));
2598  ExecuteFunctionList = GetWordList (AddWordToBlock ((char *)NULL, FList));
2599 
2600 /* Restore signals */
2601 
2602  signal (SIGINT, save_signal);
2603 }
2604 
2605 /*
2606  * Find the location of an executable and return it's full path
2607  * name
2608  */
2609 
2610 int FindLocationOfExecutable (char *FullPath,
2611  char *name)
2612 {
2613  return ExtensionType (FindFileAndExtension (FullPath, name,
2614  ExecutableList));
2615 }
2616 
2617 /*
2618  * Return the extension type for an extension
2619  */
2620 
2621 static int F_LOCAL ExtensionType (char *ext)
2622 {
2623  int i;
2624 
2625  if (ext == (char *)NULL)
2626  return EXTENSION_NOT_FOUND;
2627 
2628  for (i = 0; i < MAX_DEFAULT_EXTENSIONS; i++)
2629  {
2631  return (int)(DefaultExtensions [i].Type);
2632  }
2633 
2634  return EXTENSION_OTHER;
2635 }
2636 
2637 /*
2638  * Search the path for a file with the appropriate extension
2639  *
2640  * Returns a pointer to the extension.
2641  */
2642 
2643 static char * F_LOCAL FindFileAndExtension (char *FullPath,
2644  char *name,
2645  char **Extensions)
2646 {
2647  char *sp; /* Path pointers */
2648  char *ep;
2649  char *xp; /* In file name pointers */
2650  char *xp1;
2651  int i, fp;
2652  int pathlen;
2653 
2654 /* No extensions - no file */
2655 
2656  if (Extensions == (char **)NULL)
2657  {
2658  errno = ENOENT;
2659  return (char *)NULL;
2660  }
2661 
2662 /* Scan the path for an executable */
2663 
2664  sp = ((FindPathCharacter (name) != (char *)NULL) ||
2665  (IsDriveCharacter (*(name + 1))))
2666  ? null
2668 
2669  do
2670  {
2671  sp = BuildNextFullPathName (sp, name, FullPath);
2672  ep = &FullPath[pathlen = strlen (FullPath)];
2673 
2674 /* Get start of file name */
2675 
2676  if ((xp1 = FindLastPathCharacter (FullPath)) == (char *)NULL)
2677  xp1 = FullPath;
2678 
2679  else
2680  ++xp1;
2681 
2682 /* Look up all 5 types */
2683 
2684  for (i = 0; Extensions[i] != (char *)NULL; i++)
2685  {
2686  if (pathlen + strlen (Extensions[i]) > (size_t)(FFNAME_MAX - 1))
2687  continue;
2688 
2689  strcpy (ep, Extensions[i]);
2690 
2691  if (S_access (FullPath, F_OK))
2692  {
2693 
2694 /* If no extension, .ksh or .sh extension, check for shell script */
2695 
2696  if (((xp = strrchr (xp1, CHAR_PERIOD)) == (char *)NULL) ||
2697  (NOCASE_COMPARE (xp, SHELLExtension) == 0) ||
2699 #if (OS_TYPE == OS_NT)
2700  || (NOCASE_COMPARE (xp, SUBExtension) == 0)
2701 #endif
2702  )
2703 
2704  {
2705  if ((fp = CheckForScriptFile (FullPath, (char **)NULL,
2706  (int *)NULL)) < 0)
2707  continue;
2708 
2709  S_close (fp, TRUE);
2710  return (xp == (char *)NULL) ? null : xp;
2711  }
2712 
2713  return xp;
2714  }
2715  }
2716  } while (sp != (char *)NULL);
2717 
2718 /* Not found */
2719 
2720  errno = ENOENT;
2721  return (char *)NULL;
2722 }
2723 
2724 /*
2725  * Execute a script file
2726  */
2727 
2728 static int F_LOCAL ExecuteScriptFile (char *Fullpath,
2729  char **argv,
2730  char **envp,
2731  int ForkAction,
2732  bool ShellScript)
2733 {
2734  int res; /* Result */
2735  char *params; /* Script parameters */
2736  int nargc = 0; /* # script args */
2737  Word_B *wb = (Word_B *)NULL;
2738 #if (OS_TYPE == OS_DOS)
2739  union REGS r;
2740 #endif
2741 
2742 /* Batfile - convert to DOS Format file name */
2743 
2744  if (!ShellScript)
2745  {
2746  PATH_TO_DOS (Fullpath);
2747  nargc = 0;
2748  }
2749 
2750  else if ((res = OpenForExecution (Fullpath, &params, &nargc)) >= 0)
2751  S_close (res, TRUE);
2752 
2753  else
2754  {
2755  errno = ENOENT;
2756  return -1;
2757  }
2758 
2759 /* If BAT file, use command.com else use sh */
2760 
2761  if (!ShellScript)
2762  {
2764  return -1;
2765 
2766  wb = AddWordToBlock ("/c", wb);
2767 
2768 /* Get the switch character */
2769 
2770 #if (OS_TYPE == OS_DOS) && (OS_SIZE == OS_16)
2771  r.x.REG_AX = 0x3700;
2772  DosInterrupt (&r, &r);
2773 
2774  if ((r.h.al == 0) && (_osmajor < 4))
2775  *(wb->w_words[wb->w_nword - 1]) = (char)(r.h.dl);
2776 #endif
2777  }
2778 
2779 /* Stick in the pre-fix arguments */
2780 
2781  else if (nargc)
2782  wb = SplitString (params, wb);
2783 
2784  else if (params != null)
2785  wb = AddWordToBlock (params, wb);
2786 
2787  else
2789  wb);
2790 
2791 /* Add the rest of the parameters, and execute */
2792 
2793  res = ExecuteSpecialProcessor (Fullpath, argv, envp, ForkAction, wb);
2794 
2795 /* Release allocated space */
2796 
2797  if (params != null)
2798  ReleaseMemoryCell ((void *)params);
2799 
2800  return res;
2801 }
2802 
2803 /*
2804  * Convert errno to error message on execute
2805  */
2806 
2807 static char * F_LOCAL ConvertErrorNumber (void)
2808 {
2809  switch (errno)
2810  {
2811  case ENOMEM:
2812  return strerror (ENOMEM);
2813 
2814  case ENOEXEC:
2815  return "program corrupt";
2816 
2817  case E2BIG:
2818  return AE2big;
2819 
2820  case ENOENT:
2821  return NotFound;
2822 
2823  case 0:
2824  return "No Shell";
2825  }
2826 
2827  return "cannot execute";
2828 }
2829 
2830 /*
2831  * Swap to disk error
2832  */
2833 
2834 #ifdef OS_SWAPPING
2836 {
2837 
2838 /* Clean up */
2839 
2840  ClearSwapFile ();
2841  Swap_Mode &= (~~SWAP_DISK);
2843  errno = error;
2844  return SetCommandReturnStatus (-1);
2845 }
2846 
2847 /*
2848  * Swap to memory
2849  */
2850 
2851 static int F_LOCAL SwapToMemory (int mode, char **envp)
2852 {
2853  int res;
2854  int cr;
2855 
2856 /* Swap and close memory handler */
2857 
2858  res = SpawnProcess (envp);
2859 
2860  cr = (SW_Mode != 3) ? XMS_Close () : EMS_Close ();
2861 
2862  if ((res != -2) && cr) /* Report Close error ? */
2863  {
2864  res = -2;
2865  errno = cr;
2866  }
2867 
2868  if (res == -2)
2869  (SW_Mode != 3) ? XMS_error (SwapFailed, errno)
2870  : EMS_error (SwapFailed, errno);
2871 
2872  else
2873  {
2875  return SetCommandReturnStatus (res);
2876  }
2877 
2878 /* Failed - disabled */
2879 
2880  Swap_Mode &= (~~mode);
2881  return res;
2882 }
2883 #endif
2884 
2885 /*
2886  * Check the program type
2887  */
2888 
2889 void CheckProgramMode (char *Pname, ExeMode *PMode)
2890 {
2891  char *sp, *sp1; /* Line pointers */
2892  int nFields;
2893  char *SPname;
2894  int builtin; /* Builtin function */
2895  LineFields LF;
2896  long value;
2897 
2898 /* Check for internal no-globbed commands */
2899 
2900  if ((IsCommandBuiltIn (Pname, &builtin) != (int (*)(int, char **))NULL) &&
2902  {
2903  PMode->Flags = EP_NOEXPAND | ((builtin & BLT_NOWORDS) ? EP_NOWORDS : 0);
2904  return;
2905  }
2906 
2907 /* Set not found */
2908 
2909  PMode->Flags = EP_NONE;
2910 
2911 /* Check not a function */
2912 
2913  if ((Pname == (char *)NULL) ||
2914  ((sp = GetVariableAsString ("EXTENDED_LINE", FALSE)) == null))
2915  return;
2916 
2917 /* Get some memory for the input line and the file name */
2918 
2919  sp1 = ((sp1 = FindLastPathCharacter (Pname)) == (char *)NULL)
2920  ? Pname : sp1 + 1;
2921 
2922  if (IsDriveCharacter (*(sp1 + 1)))
2923  sp1 += 2;
2924 
2925  if ((SPname = StringCopy (sp1)) == null)
2926  return;
2927 
2928  if ((LF.Line = AllocateMemoryCell (LF.LineLength = 200)) == (char *)NULL)
2929  {
2930  ReleaseMemoryCell ((void *)SPname);
2931  return;
2932  }
2933 
2934 /* Remove terminating .exe etc */
2935 
2936  if ((sp1 = strrchr (SPname, CHAR_PERIOD)) != (char *)NULL)
2937  *sp1 = 0;
2938 
2939 /* Open the file */
2940 
2941  if ((LF.FP = FOpenFile (sp, sOpenReadMode)) == (FILE *)NULL)
2942  {
2943  ReleaseMemoryCell ((void *)LF.Line);
2944  ReleaseMemoryCell ((void *)SPname);
2945  return;
2946  }
2947 
2948 /* Initialise the internal buffer */
2949 
2950  LF.Fields = (Word_B *)NULL;
2951 
2952 /* Scan for the file name */
2953 
2954  while ((nFields = ExtractFieldsFromLine (&LF)) != -1)
2955  {
2956  if (nFields < 2)
2957  continue;
2958 
2959 /* Remove terminating .exe etc */
2960 
2961 #if (OS_TYPE != OS_UNIX)
2962  if ((sp = strrchr (LF.Fields->w_words[0], CHAR_PERIOD)) != (char *)NULL)
2963  *sp = 0;
2964 #endif
2965 
2966  if (NOCASE_COMPARE (LF.Fields->w_words[0], SPname))
2967  continue;
2968 
2969 /* What type? */
2970 
2971  if (NOCASE_COMPARE (LF.Fields->w_words[1], "unix") == 0)
2972  PMode->Flags = (unsigned int )(EP_UNIXMODE |
2973  CheckForCommonOptions (&LF, 2));
2974 
2975  else if (NOCASE_COMPARE (LF.Fields->w_words[1], LIT_dos) == 0)
2976  PMode->Flags = (unsigned int )(EP_DOSMODE |
2977  CheckForCommonOptions (&LF, 2));
2978 
2979 /* Must have a valid name and we can get memory for it */
2980 
2981  else if ((NOCASE_COMPARE (LF.Fields->w_words[1], "environ") == 0) &&
2982  (nFields >= 3) &&
2983  (!IsValidVariableName (LF.Fields->w_words[2])) &&
2984  ((PMode->Name =
2985  StringCopy (LF.Fields->w_words[2])) != null))
2986  {
2987  PMode->Flags = EP_ENVIRON;
2988  PMode->FieldSep = 0;
2989 
2990  if ((nFields >= 4) &&
2991  ConvertNumericValue (LF.Fields->w_words[3], &value, 0))
2992  PMode->FieldSep = (unsigned char)value;
2993 
2994  if (!PMode->FieldSep)
2995  PMode->FieldSep = CHAR_SPACE;
2996  }
2997 
2998  else
2999  PMode->Flags = CheckForCommonOptions (&LF, 1);
3000 
3001  break;
3002  }
3003 
3004  CloseFile (LF.FP);
3005  ReleaseMemoryCell ((void *)LF.Line);
3006  ReleaseMemoryCell ((void *)SPname);
3007 }
3008 
3009 /*
3010  * Check for common fields
3011  */
3012 
3013 static unsigned int F_LOCAL CheckForCommonOptions (LineFields *LF, int Start)
3014 {
3015  unsigned int Flags = 0;
3016  int i, j;
3017 
3018  if (LF->Fields == (Word_B *)NULL)
3019  return 0;
3020 
3021  for (i = Start; i < LF->Fields->w_nword; i++)
3022  {
3023  for (j = 0; j < COMMON_FIELD_COUNT; ++j)
3024  {
3025  if (!NOCASE_COMPARE (LF->Fields->w_words[i], CommonFields[j].Name))
3026  {
3027  Flags |= CommonFields[j].Flag;
3028  break;
3029  }
3030  }
3031  }
3032 
3033  return Flags;
3034 }
3035 
3036 /*
3037  * Convert UNIX format lines to DOS format if appropriate.
3038  * Build Environment variable for some programs.
3039  */
3040 
3041 static int F_LOCAL EnvironExecute (char **argv, int ForkAction)
3042 {
3043  int s_errno;
3044  int RetVal = 1;
3045  char *NewArgs[3];
3046  char *cp;
3047 
3048 /* If this command does not pass the command string in the environment,
3049  * no action required
3050  */
3051 
3053  return 0;
3054 
3056  == (char *)NULL)
3057  {
3059  return 0;
3060  }
3061 
3064 
3065 /* Build and execute the environment */
3066 
3067  NewArgs[0] = argv[0];
3068  NewArgs[1] = ExecProcessingMode.Name;
3069  NewArgs[2] = (char *)NULL;
3070 
3071  RetVal = LocalExecve (NewArgs, BuildCommandEnvironment (), ForkAction);
3072  s_errno = errno;
3074  errno = s_errno;
3075  return RetVal;
3076 }
3077 
3078 /*
3079  * Set Interrupt handling vectors - moved from sh0.asm
3080  */
3081 
3082 #ifdef OS_SWAPPING
3083 static int F_LOCAL SpawnProcess (char **envp)
3084 {
3085  void (interrupt far *SW_I00_V) (void); /* Int 00 address */
3086  void (interrupt far *SW_I23_V) (void); /* Int 23 address*/
3087  int res;
3088 #if 0
3089  union REGS r;
3090  unsigned char Save;
3091 
3092  r.x.REG_AX = 0x3300;
3093  DosInterrupt (&r, &r);
3094  Save = r.h.al;
3095  fprintf (stderr, "Break Status: %s (%u)\n", Save ? "on" : "off", Save);
3096 
3097  r.x.REG_AX = 0x3301;
3098  r.h.dl = 1;
3099  DosInterrupt (&r, &r);
3100  fprintf (stderr, "Break Status: %s (%u)\n", r.h.al ? "on" : "off", r.h.al);
3101 #endif
3102 
3103 /*
3104  * Save current vectors
3105  */
3106 
3107  SW_I00_V = GetInterruptVector (0x00);
3108  SW_I23_V = GetInterruptVector (0x23);
3109 
3110 /*
3111  * Set In shell flag for Interrupt 23, and set to new interrupts
3112  */
3113 
3114  SW_I23_InShell = 0;
3115 
3116  SetInterruptVector (0x23, SW_Int23);
3117  SetInterruptVector (0x00, SW_Int00);
3118 
3119  res = SA_spawn (envp);
3120 
3121 /*
3122  * Restore interrupt vectors
3123  */
3124 
3125  SetInterruptVector (0x00, SW_I00_V);
3126  SetInterruptVector (0x23, SW_I23_V);
3127 
3128 #if 0
3129  r.x.REG_AX = 0x3300;
3130  DosInterrupt (&r, &r);
3131  fprintf (stderr, "Break Status: %s (%u)\n", r.h.al ? "on" : "off", r.h.al);
3132  r.x.REG_AX = 0x3301;
3133  r.h.dl = Save;
3134  DosInterrupt (&r, &r);
3135 #endif
3136 
3137 /*
3138  * Check for an interrupt
3139  */
3140 
3141  if (SW_intr)
3142  raise (SIGINT);
3143 
3144  return res;
3145 }
3146 #endif
3147 
3148 /*
3149  * Check Parameter line length
3150  *
3151  * Under OS2, we don't build the command line. Just check it.
3152  */
3153 
3154 static bool F_LOCAL CheckParameterLength (char **argv)
3155 {
3156  int CmdLineLength;
3157  char *CommandLine;
3158  bool RetVal;
3159  char **SavedArgs = argv;
3160 
3161 /* Check for special case. If there are any special characters and we can
3162  * use UNIX mode, use it
3163  */
3164 
3166  {
3167  while (*argv != (char *)NULL)
3168  {
3169  if (strpbrk (*(argv++), WildCards) != (char *)NULL)
3170  return FALSE;
3171  }
3172  }
3173 
3174 /*
3175  * Do any parameter conversion - adding quotes or backslashes, but don't
3176  * update argv.
3177  */
3178 
3179  CmdLineLength = CountNumberArguments (argv = SavedArgs);
3180 
3181  if ((SavedArgs = (char **)
3182  AllocateMemoryCell ((CmdLineLength + 1) * sizeof (char *)))
3183  == (char **)NULL)
3184  return FALSE;
3185 
3186 /* Save a copy of the argument addresses */
3187 
3188  memcpy (SavedArgs, argv, (CmdLineLength + 1) * sizeof (char *));
3189 
3190 /* Build the command line */
3191 
3193  CHAR_SPACE)) == (char *)NULL)
3194  {
3195  ReleaseMemoryCell (SavedArgs);
3196  return FALSE;
3197  }
3198 
3199 /*
3200  * Check command line length. Under DOS, this is simple. On OS/2, we have
3201  * to remember that we default to the EMX interface, which requires
3202  * twice as much space, plus some nulls. Also remember start DOS programs
3203  * on OS/2 or NT have restricted space.
3204  */
3205 
3206  CmdLineLength = strlen (CommandLine);
3207 
3208  if ((ApplicationType & EXETYPE_DOS) &&
3209  (CmdLineLength >= DOS_CMD_LINE_MAX - 2))
3210  {
3211  errno = E2BIG;
3212  RetVal = FALSE;
3213  }
3214 
3215 #if (OS_TYPE == OS_OS2)
3216  else if (CmdLineLength >= (((CMD_LINE_MAX - 2) / 2) +
3217  CountNumberArguments (SavedArgs) + 3))
3218  {
3219  errno = E2BIG;
3220  RetVal = FALSE;
3221  }
3222 
3223 #elif (OS_TYPE == OS_NT)
3224  else if (CmdLineLength >= CMD_LINE_MAX - 2)
3225  {
3226  errno = E2BIG;
3227  RetVal = FALSE;
3228  }
3229 #endif
3230 
3231 /* Terminate the line */
3232 
3233  else
3234  {
3235 #ifdef OS_SWAPPING
3236  strcpy (cmd_line + 1, CommandLine);
3237  cmd_line[CmdLineLength + 1] = CHAR_RETURN;
3238  cmd_line[0] = (char)CmdLineLength;
3239 #endif
3240  RetVal = TRUE;
3241  }
3242 
3243  ReleaseMemoryCell (SavedArgs);
3245 
3246  return RetVal;
3247 }
3248 
3249 /*
3250  * Convert any parameters with spaces in the to start and end with double
3251  * quotes.
3252  *
3253  * Under OS2, the old string is NOT released.
3254  */
3255 
3256 static char ** F_LOCAL ProcessSpaceInParameters (char **argv)
3257 {
3258  char **Start = argv;
3259  char *new;
3260  char *cp;
3261  char *sp;
3262  int Count;
3263 
3264 /* If noquote set, don't even try */
3265 
3267  return Start;
3268 
3269 /* Protect parameters with TABS */
3270 
3271  while (*argv != (char *)NULL)
3272  {
3273  if ((strpbrk (*argv, " \t") != (char *)NULL) ||
3274  (strlen (*argv) == 0) ||
3276  (strpbrk (*argv, WildCards) != (char *)NULL)))
3277  {
3278 
3279 /* Count number of Double quotes in the parameter */
3280 
3282 
3283 /* Get some memory - give up update if out of memory */
3284 
3285  if ((new = GetAllocatedSpace (strlen (*argv) + (Count * 2) +
3286  3)) == (char *)NULL)
3287  return Start;
3288 
3289  SetMemoryAreaNumber ((void *)new,
3290  GetMemoryAreaNumber ((void *)*argv));
3291  *new = CHAR_DOUBLE_QUOTE;
3292 
3293 /* Escape any double quotes in the string */
3294 
3295  cp = *argv;
3296  sp = new + 1;
3297 
3298  while (*cp)
3299  {
3300  if (*cp == CHAR_DOUBLE_QUOTE)
3301  {
3302  *(sp++) = CHAR_META;
3303  *(sp++) = *(cp++);
3304  }
3305 
3306  else if (*cp != CHAR_META)
3307  *(sp++) = *(cp++);
3308 
3309 /* Handle escapes - count them */
3310 
3311  else
3312  {
3313  *(sp++) = *(cp++);
3314 
3315  if (*cp == CHAR_DOUBLE_QUOTE)
3316  {
3317  *(sp++) = CHAR_META;
3318  *(sp++) = CHAR_META;
3319  }
3320 
3321  else if (*cp == 0)
3322  {
3323  *(sp++) = CHAR_META;
3324  break;
3325  }
3326 
3327  *(sp++) = *(cp++);
3328  }
3329  }
3330 
3331 /* Append the terminating double quotes */
3332 
3333  strcpy (sp, DoubleQuotes);
3334  *argv = new;
3335  }
3336 
3337 /* Check for any double quotes */
3338 
3339  else if ((Count = CountDoubleQuotes (*argv)))
3340  {
3341 
3342 /* Got them - escape them */
3343 
3344  if ((new = GetAllocatedSpace (strlen (*argv) + Count + 1))
3345  == (char *)NULL)
3346  return Start;
3347 
3348  SetMemoryAreaNumber ((void *)new,
3349  GetMemoryAreaNumber ((void *)*argv));
3350 
3351 /* Copy the string, escaping DoubleQuotes */
3352 
3353  cp = *argv;
3354  sp = new;
3355 
3356  while ((*sp = *(cp++)))
3357  {
3358  if (*sp == CHAR_DOUBLE_QUOTE)
3359  {
3360  *(sp++) = CHAR_META;
3361  *sp = CHAR_DOUBLE_QUOTE;
3362  }
3363 
3364  sp++;
3365  }
3366 
3367  *argv = new;
3368  }
3369 
3370 /* Next parameter */
3371 
3372  argv++;
3373  }
3374 
3375  return Start;
3376 }
3377 
3378 /*
3379  * Count DoubleQuotes
3380  */
3381 
3382 static int F_LOCAL CountDoubleQuotes (char *string)
3383 {
3384  int Count = 0;
3385 
3386  while ((string = strchr (string, CHAR_DOUBLE_QUOTE)) != (char *)NULL)
3387  {
3388  Count++;
3389  string++;
3390  }
3391 
3392  return Count;
3393 }
3394 
3395 /*
3396  * Save and Restore the Parameters array ($1, $2 etc)
3397  */
3398 
3399 static void F_LOCAL SaveNumericParameters (char **wp, SaveParameters *SaveArea)
3400 {
3401  SaveArea->Array = ParameterArray;
3402  SaveArea->Count = ParameterCount;
3403 
3404  ParameterArray = wp;
3406  ++ParameterCount)
3407  continue;
3408 
3410 }
3411 
3413 {
3414  ParameterArray = SaveArea->Array;
3415  ParameterCount = SaveArea->Count;
3417 }
3418 
3419 /*
3420  * Special OS/2 processing for execve and spawnve
3421  */
3422 
3423 #if (OS_TYPE == OS_OS2)
3424 static int F_LOCAL OS_DosExecProgram (int Mode, char *Program, char **argv,
3425  char **envp)
3426 {
3427  OSCALL_PARAM fExecFlags;
3428  void (*sig_int)(); /* Interrupt signal */
3429  RESULTCODES rescResults;
3430  PID pidProcess;
3431  PID pidWait;
3432  char *OS2Environment;
3433  char *OS2Arguments;
3434  char **SavedArgs;
3435  int argc;
3436 
3437 /* Set the error module to null */
3438 
3439  *FailName = 0;
3440  OS_DosExecPgmReturnCode = 0;
3441 
3442 /* Convert spawn mode to DosExecPgm mode */
3443 
3444  switch (Mode)
3445  {
3446  case P_WAIT:
3447  case P_NOWAIT:
3448  fExecFlags = EXEC_ASYNCRESULT;
3449  break;
3450 
3451  case P_NOWAITO:
3452  case OLD_P_OVERLAY:
3453  fExecFlags = EXEC_ASYNC;
3454  break;
3455 
3456  case P_DETACH:
3457  fExecFlags = EXEC_BACKGROUND;
3458  break;
3459  }
3460 
3461 /* Build OS/2 argument string
3462  *
3463  * 1. Count the number of arguments.
3464  * 2. Add 2 for: 1 - NULL; 2 - argv[0]; 3 - the stringed arguments
3465  * 3. save copy of arguments at offset 2.
3466  * 4. On original argv, process white space and convert to OS2 Argument string.
3467  * 5. Set up program name at offset 2 as ~argv
3468  * 6. Convert zero length args to "~" and args beginning with ~ to ~~
3469  * 7. Build OS2 Argument string (at last).
3470  */
3471 
3473 
3474  if ((SavedArgs = (char **)AllocateMemoryCell ((argc + 3) * sizeof (char *)))
3475  == (char **)NULL)
3476  return -1;
3477 
3478  memcpy (SavedArgs + 2, argv, (argc + 1) * sizeof (char *));
3479 
3480 /* Set program name at Offset 0 */
3481 
3482  SavedArgs[0] = *argv;
3483 
3484 /* Build OS2 Argument string in Offset 1 */
3485 
3486  if ((SavedArgs[1] = BuildOS2String (ProcessSpaceInParameters (&argv[1]),
3487  CHAR_SPACE)) == (char *)NULL)
3488  return -1;
3489 
3490 /* Set up the new arg 2 - ~ + programname */
3491 
3492  if ((SavedArgs[2] = InsertCharacterAtStart (*argv)) == (char *)NULL)
3493  return -1;
3494 
3495 /* Convert zero length args and args starting with a ~ */
3496 
3497  for (argc = 3; SavedArgs[argc] != NOWORD; argc++)
3498  {
3499  if (strlen (SavedArgs[argc]) == 0)
3500  SavedArgs[argc] = "~";
3501 
3502  else if ((*SavedArgs[argc] == CHAR_TILDE) &&
3503  ((SavedArgs[argc] = InsertCharacterAtStart (SavedArgs[argc]))
3504  == (char *)NULL))
3505  return -1;
3506  }
3507 
3508 /* Build the full argument list */
3509 
3510  if ((OS2Arguments = BuildOS2String (SavedArgs, 0)) == (char *)NULL)
3511  return -1;
3512 
3513 /* Build OS/2 environment string */
3514 
3515  if ((OS2Environment = BuildOS2String (envp, 0)) == (char *)NULL)
3516  return -1;
3517 
3518 /* Change signal handling */
3519 
3520  if (fExecFlags == EXEC_ASYNCRESULT)
3521  {
3522  char *cp;
3523 
3524 /* Also change the window title to match the foreground program */
3525 
3526  if ((cp = strrchr (Program, CHAR_DOS_PATH)) == (char *)NULL)
3527  cp = Program;
3528 
3529  else
3530  cp++;
3531 
3532  strcpy (FailName, cp);
3533 
3534  if ((cp = strrchr (FailName, CHAR_PERIOD)) != (char *)NULL)
3535  *cp = 0;
3536 
3537  SetWindowName (FailName);
3538  *FailName = 0;
3539 
3540  IgnoreInterrupts = TRUE;
3541  sig_int = signal (SIGINT, SIG_IGN);
3542  }
3543 
3544 /* Exec it - with hard-error processing turned off */
3545 
3547 
3548  OS_DosExecPgmReturnCode = DosExecPgm (FailName, sizeof (FailName),
3549  fExecFlags, OS2Arguments,
3550  OS2Environment, &rescResults,
3551  Program);
3552 
3554 
3555  if (fExecFlags == EXEC_ASYNCRESULT)
3556  {
3557  signal (SIGINT, SIG_IGN);
3558 
3559 /* If the process started OK, wait for it */
3560 
3561  if (((OS_DosExecPgmReturnCode == NO_ERROR) ||
3562  (OS_DosExecPgmReturnCode == ERROR_INTERRUPT)) &&
3563  (Mode == P_WAIT))
3564  {
3565  pidWait = rescResults.codeTerminate;
3566 
3567 /* Re-try on interrupted system calls - and kill the child. Why, because
3568  * sometimes the kill does not go to the child
3569  */
3570 
3571  while ((OS_DosExecPgmReturnCode = DosCwait (DCWA_PROCESSTREE,
3572  DCWW_WAIT,
3573  &rescResults,
3574  &pidProcess,
3575  pidWait))
3576  == ERROR_INTERRUPT)
3577  DosKillProcess (DKP_PROCESS, pidWait);
3578  }
3579 
3580  IgnoreInterrupts = FALSE;
3581  signal (SIGINT, sig_int);
3582  }
3583 
3584 
3585 /*
3586  * What happened ?. OS/2 Error - Map to UNIX errno. Why can't people
3587  * write libraries right?? Or provide access at a high level. We could
3588  * call _dosret if the interface did not require me to write more
3589  * assembler.
3590  */
3591 
3592  if (OS_DosExecPgmReturnCode != 0)
3593  {
3594  switch (OS_DosExecPgmReturnCode)
3595  {
3596 #ifdef EAGAIN
3597  case ERROR_NO_PROC_SLOTS:
3598  errno = EAGAIN;
3599  return -1;
3600 #endif
3601 
3602  case ERROR_NOT_ENOUGH_MEMORY:
3603  errno = ENOMEM;
3604  return -1;
3605 
3606  case ERROR_ACCESS_DENIED:
3607  case ERROR_DRIVE_LOCKED:
3608  case ERROR_LOCK_VIOLATION:
3609  case ERROR_SHARING_VIOLATION:
3610  errno = EACCES;
3611  return -1;
3612 
3613  case ERROR_FILE_NOT_FOUND:
3614  case ERROR_PATH_NOT_FOUND:
3615  case ERROR_PROC_NOT_FOUND:
3616  errno = ENOENT;
3617  return -1;
3618 
3619  case ERROR_BAD_ENVIRONMENT:
3620  case ERROR_INVALID_DATA:
3621  case ERROR_INVALID_FUNCTION:
3622  case ERROR_INVALID_ORDINAL:
3623  case ERROR_INVALID_SEGMENT_NUMBER:
3624  case ERROR_INVALID_STACKSEG:
3625  case ERROR_INVALID_STARTING_CODESEG:
3626  errno = EINVAL;
3627  return -1;
3628 
3629  case ERROR_TOO_MANY_OPEN_FILES:
3630  errno = EMFILE;
3631  return -1;
3632 
3633  case ERROR_INTERRUPT:
3634  case ERROR_NOT_DOS_DISK:
3635  case ERROR_SHARING_BUFFER_EXCEEDED:
3636  errno = EIO;
3637  return -1;
3638 
3639  case ERROR_BAD_ARGUMENTS:
3640  errno = E2BIG;
3641  return -1;
3642 
3643  default:
3644  errno = ENOEXEC;
3645  return -1;
3646  }
3647  }
3648 
3649 /* If exec - exit */
3650 
3651  switch (Mode)
3652  {
3653  case OLD_P_OVERLAY: /* exec - exit at once */
3654  FinalExitCleanUp (0);
3655 
3656  case P_WAIT: /* Get exit code */
3657  return rescResults.codeResult;
3658 
3659  case P_NOWAIT: /* Get PID or SID */
3660  case P_NOWAITO:
3661  case P_DETACH:
3662  return rescResults.codeTerminate;
3663  }
3664 
3665  errno = EINVAL;
3666  return -1;
3667 }
3668 
3669 /*
3670  * Insert character at start of string
3671  *
3672  * Return NULL or new string
3673  */
3674 
3675 static char *InsertCharacterAtStart (char *string)
3676 {
3677  char *cp;
3678 
3679  if ((cp = (char *)AllocateMemoryCell (strlen (string) + 2)) == (char *)NULL)
3680  return (char *)NULL;
3681 
3682  *cp = CHAR_TILDE;
3683  strcpy (cp + 1, string);
3684 
3685  return cp;
3686 }
3687 #endif
3688 
3689 /*
3690  * Special NT processing for execve and spawnve. Not really sure what to
3691  * do here yet!
3692  */
3693 
3694 #if (OS_TYPE == OS_NT)
3695 static int F_LOCAL OS_DosExecProgram (int Mode, char *Program, char **argv,
3696  char **envp)
3697 {
3698  DWORD dwLogicalDrives = GetLogicalDrives();
3699  char szNewDrive[4];
3700  unsigned int i;
3701  char **new_envp;
3702  char ldir[PATH_MAX + 6];
3703  char *nt_ep;
3704  char *temp;
3705  int off = 0;
3706  STARTUPINFO StartupInfo;
3707  PROCESS_INFORMATION ProcessInformation;
3708  char *Environment;
3709  char *PgmInputs;
3710  BOOL rv;
3711  DWORD ExitCode;
3712  DWORD ExitCodeProcess;
3713 
3714  char *_akp, *_akpp;
3715  char *_akProgram;
3716 
3717 /*
3718  * Set up NT directory variables
3719  */
3720 
3721  if ((new_envp = (char **)GetAllocatedSpace (GetMemoryCellSize (envp) +
3722  sizeof (char *) * 26))
3723  == (char **)NULL)
3724  {
3725  errno = ENOMEM;
3726  return -1;
3727  }
3728 
3729  strcpy (szNewDrive, "x:");
3730 
3731 /* for (i = 0; i < 25; i++) */
3732  for (i = 2; i < 3; i++)
3733  {
3734  if (dwLogicalDrives & (1L << i))
3735  {
3736  szNewDrive[0] = i + 'A';
3737 
3738 /* If the drive does not exist - give up */
3739 
3741  ExitCode = GetFullPathName (szNewDrive, PATH_MAX + 6, ldir, &temp);
3743 
3744  if (!ExitCode)
3745  continue;
3746 
3747  if ((nt_ep = GetAllocatedSpace (strlen (ldir) + 5)) == (char *)NULL)
3748  {
3749  errno = ENOMEM;
3750  return -1;
3751  }
3752 
3753  sprintf (nt_ep, "=%c:=%s", i + 'A', ldir);
3754  new_envp[off++] = nt_ep;
3755  }
3756  }
3757 
3758  memcpy (&new_envp[off], envp, GetMemoryCellSize (envp));
3759 
3760 /* Setup environment block */
3761 
3762  if ((Environment = BuildOS2String (new_envp, 0)) == (char *)NULL)
3763  return -1;
3764 
3765 /* Setup parameter block */
3766 
3768 
3769  _akProgram = (char *)malloc(strlen(Program) + 1);
3770  if((_akp = strrchr(Program, '\\')) != NULL)
3771  _akp++;
3772  else
3773  _akp = Program;
3774  strcpy(_akProgram, _akp);
3775  if((_akpp = strrchr(_akProgram, '.')) != NULL) {
3776  if(stricmp(_akpp, ".exe") == 0)
3777  *_akpp = '\0';
3778  }
3779  argv[0] = _akProgram;
3780 
3781  if ((PgmInputs = BuildOS2String (argv, CHAR_SPACE)) == (char *)NULL) {
3782  if(_akProgram) {
3783  free(_akProgram); _akProgram = NULL;
3784  }
3785  return -1;
3786  }
3787 
3788 /* Set up startup info */
3789 
3790  memset (&StartupInfo, 0, sizeof (StartupInfo));
3791 
3792  StartupInfo.cb = sizeof (StartupInfo);
3793  StartupInfo.lpDesktop = NULL;
3794  StartupInfo.lpTitle = NULL;
3795  StartupInfo.dwFlags = 0;
3796 
3797 /* Change Window name ? */
3798 
3799  if (Mode == P_WAIT)
3800  {
3801  char *cp;
3802  char *Name;
3803 
3804 /* Also change the window title to match the foreground program */
3805 
3806  if ((cp = strrchr (Program, CHAR_DOS_PATH)) == (char *)NULL)
3807  cp = Program;
3808 
3809  else
3810  cp++;
3811 
3812  Name = StringCopy (cp);
3813 
3814  if ((cp = strrchr (Name, CHAR_PERIOD)) != (char *)NULL)
3815  *cp = 0;
3816 
3817  SetWindowName (Name);
3819  }
3820 
3821 /* Exec it - with hard-error processing turned off */
3822 
3824  rv = CreateProcess (Program, PgmInputs, NULL, NULL, TRUE,
3825  NORMAL_PRIORITY_CLASS,
3826  Environment, NULL, &StartupInfo, &ProcessInformation);
3827 /*#define DETACHED_PROCESS 0x00000008*/
3828 
3830 
3831  if (!rv)
3832  {
3833  OS_DosExecPgmReturnCode = GetLastError ();
3834  errno = ENOENT;
3835  if(_akProgram) {
3836  free(_akProgram); _akProgram = NULL;
3837  }
3838  return -1;
3839  }
3840 
3841 /* begin A.K. */
3842  CloseHandle(ProcessInformation.hThread);
3843 /* end A.K. */
3844 
3845  if (Mode == P_WAIT)
3846  {
3847  if ((ExitCode = WaitForSingleObject (ProcessInformation.hProcess,
3848  INFINITE)) == WAIT_OBJECT_0)
3849  {
3850  GetExitCodeProcess (ProcessInformation.hProcess, &ExitCodeProcess);
3851 /* begin A.K. */
3852  CloseHandle(ProcessInformation.hProcess);
3853  if(_akProgram) {
3854  free(_akProgram); _akProgram = NULL;
3855  }
3856 /* end A.K. */
3857  return ExitCodeProcess;
3858  }
3859 
3860 /* Wait failed */
3861 /* begin A.K. */
3862  CloseHandle(ProcessInformation.hProcess);
3863 /* end A.K. */
3864  OS_DosExecPgmReturnCode = GetLastError ();
3865  errno = EINVAL;
3866  if(_akProgram) {
3867  free(_akProgram); _akProgram = NULL;
3868  }
3869  return -1;
3870  }
3871 
3872 /* begin A.K. */
3873  CloseHandle(ProcessInformation.hProcess);
3874 /* end A.K. */
3875 
3876 /* Otherwise, return the process ID. */
3877  if(_akProgram) {
3878  free(_akProgram); _akProgram = NULL;
3879  }
3880 
3881  return ProcessInformation.dwProcessId;
3882 }
3883 #endif
3884 
3885 /*
3886  * Execute a Function
3887  */
3888 
3889 static bool F_LOCAL ExecuteFunction (char **wp, int *RetVal, bool CGVLCalled)
3890 {
3891  Break_C *s_RList = Return_List;
3892  Break_C *s_BList = Break_List;
3893  Break_C *s_SList = SShell_List;
3894  Break_C BreakContinue;
3895  C_Op *New;
3896  FunctionList *s_CurrentFunction = CurrentFunction;
3897  SaveParameters s_Parameters;
3898  FunctionList *fop;
3899  GetoptsIndex GetoptsSave;
3900  bool TrapZeroExists;
3901  char *Ext;
3902  char *FullPath;
3903 
3904  TrapZeroExists = C2bool (GetVariableAsString ("~0", FALSE) != null);
3905 
3906 /* Find the extension type - if it exists */
3907 
3908  FullPath = GetAllocatedSpace (FFNAME_MAX);
3909 
3910 /* Check for a psuedo-function */
3911 
3912  switch (ExtensionType (Ext = FindFileAndExtension (FullPath,
3913  wp[0],
3915  {
3916  case EXTENSION_OTHER:
3917  if ((fop = LookUpFunction (Ext, TRUE)) == (FunctionList *)NULL)
3918  return FALSE;
3919 
3920  wp[0] = FullPath;
3921  break;
3922 
3923 /* Common extension for all .sh, .ksh and "" scripts. If we find one, use
3924  * it, otherwise, check for a function of this name
3925  */
3926 
3928  Ext = ".ksh";
3929 
3930  case EXTENSION_BATCH:
3931  if ((fop = LookUpFunction (Ext, TRUE)) != (FunctionList *)NULL)
3932  {
3933  wp[0] = FullPath;
3934  break;
3935  }
3936 
3937 /* Check for a real function */
3938 
3939  case EXTENSION_NOT_FOUND:
3940  case EXTENSION_EXECUTABLE:
3941  default:
3942  if ((fop = LookUpFunction (wp[0], FALSE)) == (FunctionList *)NULL)
3943  return FALSE;
3944  }
3945 
3946 /* Ok, we really have a function to execute.
3947  * Save the current variable list
3948  */
3949 
3950  if (!CGVLCalled && (CreateGlobalVariableList (FLAGS_FUNCTION) == -1))
3951  {
3952  *RetVal = -1;
3953  return TRUE;
3954  }
3955 
3956 /* Set up $0..$n for the function */
3957 
3958  SaveNumericParameters (wp, &s_Parameters);
3959 
3960 /* Save Getopts pointers */
3961 
3962  GetGetoptsValues (&GetoptsSave);
3963 
3964 /* Process the function */
3965 
3966  if (setjmp (BreakContinue.CurrentReturnPoint) == 0)
3967  {
3968  CurrentFunction = fop;
3969  Break_List = (Break_C *)NULL;
3970  BreakContinue.NextExitLevel = Return_List;
3971  Return_List = &BreakContinue;
3972  New = CopyFunction (fop->tree->left);
3973  *RetVal = ExecuteParseTree (New, NOPIPE, NOPIPE, EXEC_FUNCTION);
3974  }
3975 
3976 /* A return has been executed - Unlike, while and for, we just need to
3977  * restore the local execute stack level and the return will restore
3978  * the correct I/O.
3979  */
3980 
3981  else
3983 
3984  if (!TrapZeroExists)
3985  RunTrapCommand (0); /* Exit trap */
3986 
3987 /* Restore the old $0, and previous return address */
3988 
3989  SaveGetoptsValues (GetoptsSave.Index, GetoptsSave.SubIndex);
3990  Break_List = s_BList;
3991  Return_List = s_RList;
3992  SShell_List = s_SList;
3993  CurrentFunction = s_CurrentFunction;
3994  RestoreTheParameters (&s_Parameters);
3995 
3996  return TRUE;
3997 }
3998 
3999 /*
4000  * Print Load error message
4001  */
4002 
4003 #if (OS_TYPE == OS_OS2)
4004 static void F_LOCAL PrintLoadError (char *path)
4005 {
4006  if (*FailName)
4007  PrintWarningMessage ("%s: %s\nSYS1804: Cannot find file - %s", path,
4008  ConvertErrorNumber(), FailName);
4009 
4010  else if (OS_DosExecPgmReturnCode)
4011  PrintWarningMessage ("%s: %s\n%s", path, ConvertErrorNumber(),
4012  GetOSSystemErrorMessage (OS_DosExecPgmReturnCode));
4013 
4014  else
4016 }
4017 #endif
4018 
4019 /* NT Version */
4020 
4021 #if (OS_TYPE == OS_NT)
4022 static void F_LOCAL PrintLoadError (char *path)
4023 {
4024  if (OS_DosExecPgmReturnCode)
4025  PrintWarningMessage ("%s: %s\n%s", path, ConvertErrorNumber(),
4026  GetOSSystemErrorMessage (OS_DosExecPgmReturnCode));
4027 
4028  else
4030 }
4031 #endif
4032 
4033 /* DOS Version */
4034 
4035 #if (OS_TYPE == OS_DOS)
4036 static void F_LOCAL PrintLoadError (char *path)
4037 {
4039 }
4040 #endif
4041 
4042 /* DOS Version */
4043 
4044 #if (OS_TYPE == OS_UNIX)
4045 static void F_LOCAL PrintLoadError (char *path)
4046 {
4048 }
4049 #endif
4050 
4051 /*
4052  * Make the exported environment from the exported names in the dictionary.
4053  * Keyword assignments will already have been done. Convert to MSDOS
4054  * format if flag set and m enabled
4055  */
4056 
4057 static char ** F_LOCAL BuildCommandEnvironment (void)
4058 {
4059 /* Update SECONDS and RANDOM */
4060 
4062 
4063 /* Build the environment by walking the tree */
4064 
4065  BCE_WordList = (Word_B *)NULL;
4066  BCE_Length = 0;
4067 
4069 
4070  if (BCE_Length >= 0x7f00)
4071  return (char **)NULL;
4072 
4074 }
4075 
4076 /*
4077  * TWALK Function - Build Export VARIABLE list from VARIABLE tree
4078  */
4079 
4080 static void BuildEnvironmentEntry (const void *key, VISIT visit, int level)
4081 {
4082  VariableList *vp = *(VariableList **)key;
4083  char *cp;
4084  char *sp;
4085  int tlen;
4086 
4087  if ((visit != postorder) && (visit != leaf))
4088  return;
4089 
4090  if ((vp->status & STATUS_EXPORT) && (vp->index == 0))
4091  {
4092  cp = GetVariableAsString (vp->name, TRUE);
4093  tlen = strlen (vp->name) + strlen (cp) + 2;
4094 
4095  if ((BCE_Length += tlen) >= 0x7f00)
4096  return;
4097 
4098  strcpy ((sp = GetAllocatedSpace (tlen)), vp->name);
4100  strcat (sp, "=");
4101  strcat (sp, cp);
4102 
4104 
4105 /* If MSDOS mode, we need to copy the variable, convert / to \ and put
4106  * the copy in the environment list instead
4107  */
4108 
4111  (vp->status & STATUS_CONVERT_MSDOS))
4112  {
4115  }
4116  }
4117 }
4118 
4119 /*
4120  * Parse and Execute a command in the current shell
4121  */
4122 
4123 int RunACommand (Source *s, char **params)
4124 {
4125  jmp_buf erp;
4126  int RetVal = -1;
4127  Break_C *S_RList = Return_List; /* Save loval links */
4128  Break_C *S_BList = Break_List;
4129  int LS_depth = Execute_stack_depth++;
4130  C_Op *outtree;
4131  bool s_ProcessingEXECCommand = ProcessingEXECCommand;
4132  SaveParameters s_Parameters;
4133 
4134 /* Create a new save area */
4135 
4136  MemoryAreaLevel++;
4137 
4138 /* Set up $0..$n for the command if appropriate. Note that $0 does not
4139  * change
4140  */
4141 
4142  if (params != NOWORDS)
4143  {
4144  SaveNumericParameters (params, &s_Parameters);
4145  ParameterArray[0] = s_Parameters.Array[0];
4146  }
4147 
4148 /* Execute the command */
4149 
4151 
4152  Return_List = (Break_C *)NULL;
4153  Break_List = (Break_C *)NULL;
4156 
4157  if (SetErrorPoint (erp) == 0)
4158  {
4159 
4160 /* Read Input until completed */
4161 
4162  while (TRUE)
4163  {
4164  if (((outtree = BuildParseTree (s)) != (C_Op *)NULL) &&
4165  (outtree->type == TEOF))
4166  break;
4167 
4168  RetVal = ExecuteParseTree (outtree, NOPIPE, NOPIPE, 0);
4169  }
4170  }
4171 
4173 
4174 /* Restore the environment */
4175 
4177  Return_List = S_RList;
4178  Break_List = S_BList;
4179  ProcessingEXECCommand = s_ProcessingEXECCommand;
4180 
4181 /* Restore $0..$n */
4182 
4183  if (params != NOWORDS)
4184  RestoreTheParameters (&s_Parameters);
4185 
4186  RestoreEnvironment (RetVal, LS_depth);
4188  return RetVal;
4189 }
4190 
4191 /*
4192  * Get the OS/2 Error message
4193  */
4194 
4195 #if (OS_TYPE == OS_OS2)
4196 char *GetOSSystemErrorMessage (OSCALL_RET code)
4197 {
4198  static char Buffer [FFNAME_MAX + 9];
4199  char *Buffer1;
4200  OSCALL_PARAM MsgLength;
4201  OSCALL_RET rc;
4202  char *ip;
4203  char *op = Buffer;
4204  char *sp;
4205  int len;
4206 
4207 /* For some reason DPATH does not work with the DosGetMessage API as the
4208  * spec say it should on OS/2 2.x. Probably something we do. It usually
4209  * is! So emulate it!
4210  */
4211 
4212  if ((len = strlen (sp = GetVariableAsString ("DPATH", FALSE))) < FFNAME_MAX)
4213  len = FFNAME_MAX;
4214 
4215  if ((Buffer1 = GetAllocatedSpace (len)) == (char *)NULL)
4216  {
4217  sprintf (Buffer, "SYS%.4d: No memory to get message text", code);
4218  return Buffer;
4219  }
4220 
4221  sp = PATH_TO_UNIX (strcpy (Buffer1, sp));
4222 
4223  do
4224  {
4225  sp = BuildNextFullPathName (sp, "OSO001.MSG", Buffer);
4226  } while ((access (Buffer, F_OK) != 0) && (sp != (char *)NULL));
4227 
4228 /* If not found - use the default */
4229 
4230  if (sp == (char *)NULL)
4231  {
4232  strcpy (Buffer, "c:/OS2/SYSTEM/OSO001.MSG");
4234  }
4235 
4236 /* Read the message */
4237 
4238  if ((rc = DosGetMessage (NULL, 0, ip = Buffer1, len, code, Buffer,
4239  &MsgLength)))
4240  sprintf (Buffer, "SYS%.4d: No error message available (%d)",
4241  code, rc);
4242 
4243  else
4244  {
4245  if ((Buffer1[MsgLength - 1] == CHAR_NEW_LINE) &&
4246  (Buffer1[MsgLength - 2] == CHAR_RETURN))
4247  Buffer1[MsgLength - 2] = 0;
4248 
4249  else
4250  Buffer1[MsgLength] = 0;
4251 
4252 /* Check the error number is there */
4253 
4254  if (strncmp (Buffer1, "SYS", 3) != 0)
4255  {
4256  sprintf (op, "SYS%.4d: ", code);
4257  op += strlen (op);
4258  }
4259 
4260 /* Remove interior CRs & NLs */
4261 
4262  while ((*(op) = *(ip++)))
4263  {
4264  if (*op == CHAR_NEW_LINE)
4265  *(op++) = CHAR_SPACE;
4266 
4267  else if (*op != CHAR_RETURN)
4268  op++;
4269  }
4270  }
4271 
4272  ReleaseMemoryCell (Buffer1);
4273  return Buffer;
4274 }
4275 
4276 # ifdef __WATCOMC__
4277 
4278 /*
4279  * A cheat for WATCOM which does not have the DosGetMessage API. This
4280  * function is based an interpretation of the System message file and one or
4281  * two others. The format of the header is not know except for the flag at
4282  * offset 0x0f. It is not guaranteed to work.
4283  */
4284 
4285 APIRET APIENTRY DosGetMessage (PCHAR *ppchVTable,
4286  ULONG usVCount,
4287  PCHAR pchBuf,
4288  ULONG cbBuf,
4289  ULONG usMsgNum,
4290  PSZ pszFileName,
4291  PULONG pcbMsg)
4292 {
4293  int fd;
4294 # pragma pack (1)
4295  union {
4296  struct {
4297  USHORT Start;
4298  USHORT End;
4299  } ShortE;
4300  struct {
4301  ULONG Start;
4302  ULONG End;
4303  } LongE;
4304  } Start, Current;
4305 # pragma pack ()
4306  char Type;
4307  int Len;
4308  unsigned long Offset;
4309  APIRET Res;
4310 
4311  if ((fd = open (pszFileName, O_RDONLY | O_BINARY)) < 0)
4312  return _doserrno;
4313 
4314 /* Get the message file format */
4315 
4316  if ((lseek (fd, 0x0fL, SEEK_SET) != 0x0fL) ||
4317  (read (fd, &Type, 1) != 1) ||
4318  (lseek (fd, 0x1fL, SEEK_SET) != 0x1fL))
4319  {
4320  Res = _doserrno;
4321  close (fd);
4322  return Res;
4323  }
4324 
4325 /* Read the start of message text location */
4326 
4327  Len = (Type) ? 4 : 8;
4328 
4329  if (read (fd, &Start, Len) != Len)
4330  {
4331  Res = _doserrno;
4332  close (fd);
4333  return Res;
4334  }
4335 
4336 /* Check the offset to the message */
4337 
4338  Offset = 0x1fL + (usMsgNum * ((Type) ? 2L : 4L));
4339 
4340  if (((Type) && (Offset >= Start.ShortE.Start)) ||
4341  ((!Type) && (Offset >= Start.LongE.Start)))
4342  {
4343  close (fd);
4344  return ERROR_MR_MID_NOT_FOUND;
4345  }
4346 
4347 /* Get the message location */
4348 
4349  if ((lseek (fd, Offset, SEEK_SET) != Offset) ||
4350  (read (fd, &Current, Len) != Len))
4351  {
4352  Res = _doserrno;
4353  close (fd);
4354  return Res;
4355  }
4356 
4357  if (((Type) && (Offset == Start.ShortE.Start - 2)) ||
4358  ((!Type) && (Offset == Start.LongE.Start - 4)))
4359  {
4360  if ((Offset = lseek (fd, 0L, SEEK_END)) == -1L)
4361  {
4362  Res = _doserrno;
4363  close (fd);
4364  return Res;
4365  }
4366 
4367  else if (Type)
4368  Current.ShortE.End = (USHORT)Offset;
4369 
4370  else
4371  Current.LongE.End = Offset;
4372  }
4373 
4374 /* Get the message length */
4375 
4376  if (Type)
4377  {
4378  *pcbMsg = Current.ShortE.End - Current.ShortE.Start;
4379  Offset = Current.ShortE.Start;
4380  }
4381 
4382  else
4383  {
4384  *pcbMsg = (USHORT)(Current.LongE.End - Current.LongE.Start);
4385  Offset = Current.LongE.Start;
4386  }
4387 
4388 /* Check the message length */
4389 
4390  *pcbMsg += 8;
4391 
4392  if (*pcbMsg >= cbBuf)
4393  return ERROR_MR_MSG_TOO_LONG;
4394 
4395  sprintf (pchBuf, "SYS%.4d: ", usMsgNum);
4396 
4397 /* Seek to the start of the message and read its type */
4398 
4399  if ((lseek (fd, Offset, SEEK_SET) != Offset) ||
4400  (read (fd, &Type, 1) != 1))
4401  {
4402  Res = _doserrno;
4403  close (fd);
4404  return Res;
4405  }
4406 
4407  if (Type == '?')
4408  {
4409  close (fd);
4410  return ERROR_MR_MID_NOT_FOUND;
4411  }
4412 
4413 /* Get the message itself */
4414 
4415  else if (read (fd, pchBuf + 9, *pcbMsg - 8) != *pcbMsg - 8)
4416  {
4417  Res = _doserrno;
4418  close (fd);
4419  return Res;
4420  }
4421 
4422  close (fd);
4423  *(pchBuf + *pcbMsg) = 0;
4424  return 0;
4425 }
4426 # endif
4427 #endif
4428 
4429 /*
4430  * Get the Win NT Error message
4431  */
4432 
4433 #if (OS_TYPE == OS_NT)
4434 char *GetOSSystemErrorMessage (OSCALL_RET code)
4435 {
4436  DWORD Source = 0;
4437  static char EBuffer[100];
4438  char *OSBuffer;
4439  char *Buffer1;
4440  char *ip;
4441  char *op;
4442 
4443 /* Read the message */
4444 
4445  if (!FormatMessage ((FORMAT_MESSAGE_FROM_SYSTEM |
4446  FORMAT_MESSAGE_ALLOCATE_BUFFER), &Source, code, 0,
4447  (LPSTR)&OSBuffer, 100, NULL))
4448  {
4449  sprintf (EBuffer, "SYS%.4d: No error message available (%ld)",
4450  code, GetLastError ());
4451  OSBuffer = EBuffer;
4452  }
4453 
4454  else
4455  {
4456  op = &OSBuffer[strlen (OSBuffer) - 1];
4457 
4458  while (isspace (*op) && (op != OSBuffer))
4459  op--;
4460  }
4461 
4462 /* Allocate local space. If there isn't any give up and hope for the best */
4463 
4464  if ((Buffer1 = GetAllocatedSpace (strlen (OSBuffer) + 20)) == (char *)NULL)
4465  return OSBuffer;
4466 
4467 /* Transfer the system buffer to a local buffer.
4468  * Check the error number is there
4469  */
4470 
4471  op = Buffer1;
4472  ip = OSBuffer;
4473 
4474  if (strncmp (OSBuffer, "SYS", 3) != 0)
4475  {
4476  sprintf (op, "SYS%.4d: ", code);
4477  op += strlen (op);
4478  }
4479 
4480 /* Remove interior CRs & NLs */
4481 
4482  while (*(op) = *(ip++))
4483  {
4484  if (*op == CHAR_NEW_LINE)
4485  *(op++) = CHAR_SPACE;
4486 
4487  else if (*op != CHAR_RETURN)
4488  op++;
4489  }
4490 
4491  if (OSBuffer != EBuffer)
4492  LocalFree (OSBuffer);
4493 
4494  return Buffer1;
4495 }
4496 #endif
4497 
4498 /*
4499  * Display a started job info
4500  */
4501 
4502 #if (OS_TYPE != OS_DOS)
4503 static void F_LOCAL PrintPidStarted (void)
4504 {
4505  if (PidInfo.Valid)
4506  fprintf (stderr, "[%d] %d\n", PidInfo.JobNo, PidInfo.PidNo);
4507 
4508  PidInfo.Valid = FALSE;
4509 }
4510 #endif
4511 
4512 /*
4513  * Print a list of names, with or without numbers
4514  */
4515 
4516 void PrintAList (int ArgCount, char **ArgList)
4517 {
4518  char **pp = ArgList;
4519  int i, j;
4520  int ix;
4521  int MaxArgWidth = 0;
4522  int NumberWidth = 0;
4523  int ncols;
4524  int nrows;
4525 
4526  if (!ArgCount)
4527  return;
4528 
4529 /* get dimensions of the list */
4530 
4531  while (*pp != (char *)NULL)
4532  {
4533  i = strlen (*(pp++)) + 1;
4534  MaxArgWidth = (i > MaxArgWidth) ? i : MaxArgWidth;
4535  }
4536 
4537 /*
4538  * We print an index of the form
4539  * %d)
4540  * in front of each entry. Get the max width of this
4541  */
4542 
4543  for (i = ArgCount, NumberWidth = 1; i >= 10; i /= 10)
4544  NumberWidth++;
4545 
4546 /* In the case of numbered lists, we go down if less than screen length */
4547 
4548  if (ArgCount < (MaximumLines - 5))
4549  {
4550  ncols = 1;
4551  nrows = ArgCount;
4552  }
4553 
4554  else
4555  {
4556  ncols = MaximumColumns / (MaxArgWidth + NumberWidth + 3);
4557  nrows = ArgCount / ncols;
4558 
4559  if (ArgCount % ncols)
4560  nrows++;
4561 
4562  if (!nrows)
4563  nrows = 1;
4564 
4565  if (ncols > nrows)
4566  {
4567  nrows = ncols;
4568  ncols = 1;
4569  }
4570  }
4571 
4572 /* Display the list */
4573 
4574  for (i = 0; i < nrows; i++)
4575  {
4576  for (j = 0; j < ncols; j++)
4577  {
4578  if ((ix = j * nrows + i) < ArgCount)
4579  {
4580  printf ("%*d) ", NumberWidth, ix + 1);
4581 
4582  if (j != (ncols - 1))
4583  printf ("%-*.*s", MaxArgWidth, MaxArgWidth, ArgList[ix]);
4584 
4585  else
4586  printf ("%-s", ArgList[ix]);
4587  }
4588  }
4589 
4590  fputchar (CHAR_NEW_LINE);
4591  }
4592 }
4593 
4594 /*
4595  * Are we tracking all commands? Check there is no path in the command
4596  */
4597 
4598 static void F_LOCAL TrackAllCommands (char *path, char *arg)
4599 {
4600  if (FL_TEST (FLAG_TRACK_ALL) &&
4601  (FindPathCharacter (arg) == (char *)NULL) &&
4602  (!IsDriveCharacter (arg[1])))
4603  SaveAlias (arg, PATH_TO_UNIX (path), TRUE);
4604 }
4605 
4606 /*
4607  * Declare added static function is_64bit_exe()
4608  * 2020/05/03 --ak
4609  */
4610 static int is_64bit_exe(char *path);
4611 
4612 /*
4613  * Get the application type and get we can do it
4614  */
4615 
4616 static bool F_LOCAL GetApplicationType (char *path)
4617 {
4619 
4620 /* Some type of error */
4621 
4623  {
4625  {
4626  if (!FL_TEST (FLAG_WARNING)) {
4627  if (is_64bit_exe(path)) {
4628 /*
4629  fprintf (stderr, "sh: 64bit executable.\n");
4630 */
4631  return TRUE;
4632  }
4633  }
4634  errno = ENOEXEC;
4635  return FALSE;
4636  }
4637 
4638  else if (ApplicationType == EXETYPE_BAD_FILE)
4639  errno = ENOENT;
4640 
4641  else
4642  errno = ENOEXEC;
4643 
4644  return FALSE;
4645  }
4646 
4647 /*
4648  * This is where it gets complicated - Sort out DOS!
4649  */
4650 
4651 #if (OS_TYPE == OS_DOS)
4653  {
4655  return TRUE;
4656  }
4657 
4658  else if (ApplicationType == EXETYPE_DOS_GUI)
4659  {
4660  if ((BaseOS == BASE_OS_WIN) &&
4662  {
4663  if (!FL_TEST (FLAG_WARNING))
4664  feputs ("sh: Start this applications from Windows\n");
4665 
4666  errno = ENOEXEC;
4667  return FALSE;
4668  }
4669  }
4670 
4671  else if ((ApplicationType == EXETYPE_DOS_32) && (BaseOS == BASE_OS_NT))
4672  return BadApplication ("DOS 32-bit");
4673 
4674  else if (ApplicationType & EXETYPE_OS2)
4675  return BadApplication ("OS/2");
4676 
4677  else if (ApplicationType & EXETYPE_NT)
4678  return (BaseOS == BASE_OS_NT) ? TRUE : BadApplication ("Win NT");
4679 
4680 #elif (OS_TYPE == OS_OS2)
4681 
4682 /*
4683  * OK - now OS/2
4684  */
4685 
4687  return BadApplication ("Win NT");
4688 
4689 # if (OS_SIZE == OS_16)
4690  if (OS_VERS_N < 2)
4691  {
4693  return BadApplication (LIT_dos);
4694 
4695  else if (ApplicationType & EXETYPE_OS2_32)
4696  return BadApplication ("OS/2 32-bit");
4697  }
4698 # endif
4699 
4701  return BadApplication ("DOS 32-bit");
4702 
4703 #elif (OS_TYPE == OS_NT)
4704 
4705 /*
4706  * OK - now NT
4707  */
4708 
4710  return BadApplication ("DOS 32-bit");
4711 
4712  else if (ApplicationType & EXETYPE_OS2_32)
4713  return BadApplication ("OS/2 32-bit");
4714 #endif
4715 
4716 /* In the end - execute it */
4717 
4718  return TRUE;
4719 }
4720 
4721 /*
4722  * Print Bad application warning
4723  */
4724 
4725 static bool F_LOCAL BadApplication (char *mes)
4726 {
4727  if (!FL_TEST (FLAG_WARNING))
4728  fprintf (stderr, "sh: Cannot execute %s applications\n", mes);
4729 
4730  errno = ENOEXEC;
4731  return FALSE;
4732 }
4733 
4734 /*
4735  * Handle a Windows Program
4736  */
4737 
4738 #if (OS_TYPE != OS_UNIX)
4739 static int F_LOCAL ExecuteWindows (char *Fullpath, char **argv, char **envp,
4740  int ForkAction)
4741 {
4742  int res;
4743 # if (OS_TYPE == OS_DOS)
4744  Word_B *wb = (Word_B *)NULL;
4745 
4746  if (!SetUpCLI ((BaseOS != BASE_OS_WIN)
4747  ? "win"
4749  return -1;
4750 
4751 # elif (OS_TYPE == OS_OS2)
4752  Word_B *wb = AddWordToBlock ("winos2", (Word_B *)NULL);
4753 # elif (OS_TYPE == OS_NT)
4754  Word_B *wb = (Word_B *)NULL;
4755 # endif
4756 
4757 /* Add the rest of the parameters and execute */
4758 
4759  ForkAction |= EXEC_WINDOWS;
4760 
4761  res = ExecuteSpecialProcessor (Fullpath, argv, envp, ForkAction, wb);
4762 
4763 /* A cheat to stop us exec'ing the program again. Normally,
4764  * ExecuteSpecialProcessor is call below ExecuteProgram. However, in the
4765  * case of a Windows prog, its called above, so we set this to stop
4766  * Executeprogram invoking the program again, but telling it that no
4767  * swapping was required.
4768  */
4769 
4771  return res;
4772 }
4773 #endif
4774 
4775 /*
4776  * Generic processing for script and windows programs
4777  */
4778 
4779 static int F_LOCAL ExecuteSpecialProcessor (char *Fullpath, char **argv,
4780  char **envp, int ForkAction,
4781  Word_B *wb)
4782 {
4783  char **nargv;
4784  char *p_name; /* Program name */
4785  char *cp;
4786  int j;
4787 
4788 /* Add the rest of the parameters */
4789 
4790  wb = AddWordToBlock (Fullpath, wb);
4791 
4792  j = 1;
4793  while (argv[j] != NOWORD)
4794  wb = AddWordToBlock (argv[j++], wb);
4795 
4796 /* Execute the program */
4797 
4798  nargv = GetWordList (AddWordToBlock (NOWORD, wb));
4799 
4800 /* Special for UNIX compatability, use ourselves */
4801 
4802  if ((strcmp (nargv[0], "/bin/sh") == 0) ||
4803  (strcmp (nargv[0], "/bin/ksh") == 0))
4805 
4806 /* See if the program exists. If it doesn't, strip the path */
4807 
4808  else if (((cp = strrchr (nargv[0], CHAR_UNIX_DIRECTORY)) != (char *)NULL) &&
4809  ((p_name = AllocateMemoryCell (FFNAME_MAX)) != (char *)NULL))
4810  {
4811  if (FindLocationOfExecutable (p_name, nargv[0]) == EXTENSION_NOT_FOUND)
4812  strcpy (nargv[0], cp + 1);
4813 
4814  ReleaseMemoryCell (p_name);
4815  }
4816 
4817 /* Get the new program mode */
4818 
4820 
4821  j = EnvironExecute (nargv, ForkAction);
4822 
4824  j = LocalExecve (nargv, envp, ForkAction);
4825 
4826 /* 0 is a special case - see ConvertErrorNumber */
4827 
4828  if (j == -1)
4829  errno = 0;
4830 
4831  return j;
4832 }
4833 
4834 /*
4835  * Parse a new CLI string
4836  */
4837 
4838 static bool F_LOCAL SetUpCLI (char *string, Word_B **wb)
4839 {
4840  char *sp = StringCopy (string);
4841 
4842  if (sp == null)
4843  return FALSE;
4844 
4845  *wb = SplitString (sp, *wb);
4846  return TRUE;
4847 }
4848 
4849 /*
4850  * Add for 64bit exe test 2020/05/03 --ak
4851  */
4852 #include <windows.h>
4853 #include <winnt.h>
4854 static int is_64bit_exe(char *path)
4855 {
4856  FILE *fp;
4857  IMAGE_DOS_HEADER image_dos_header;
4858  IMAGE_FILE_HEADER image_file_header;
4859  WORD ww;
4860 
4861  fp = fopen(path, "rb");
4862  if (fp == NULL) {
4863  return 0;
4864  }
4865  fread(&image_dos_header, sizeof(image_dos_header), 1, fp);
4866  fseek(fp, image_dos_header.e_lfanew + 4, SEEK_SET);
4867  fread(&image_file_header, sizeof(image_file_header), 1, fp);
4868  fclose(fp);
4869  ww = image_file_header.Characteristics;
4870  if ((ww & IMAGE_FILE_LARGE_ADDRESS_AWARE) &&
4871  !(ww & IMAGE_FILE_DLL))
4872  return 1;
4873  return 0;
4874 }
return _Result< 0 ? -1 :_Result;} #line 1069 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vsnwprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsnwprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1091 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vsnwprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format, va_list _ArgList) { return _vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);} #line 1108 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format, va_list _Args);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format, va_list _ArgList) { return _vsnwprintf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1133 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_c_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1163 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_c(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1179 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);} #line 1196 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl __vswprintf_l(wchar_t *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vswprintf_l(_Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1212 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf(wchar_t *const _Buffer, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_l(_Buffer,(size_t) -1, _Format,((void *) 0), _ArgList);} #line 1227 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswprintf(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1243 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1264 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1281 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 1283 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_p_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf_p((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1312 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswprintf_p(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, va_list _ArgList) { return _vswprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1328 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf_l(wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1347 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf(wchar_t const *const _Format, va_list _ArgList) { return _vscwprintf_l(_Format,((void *) 0), _ArgList);} #line 1361 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf_p_l(wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vswprintf_p((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1380 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vscwprintf_p(wchar_t const *const _Format, va_list _ArgList) { return _vscwprintf_p_l(_Format,((void *) 0), _ArgList);} #line 1394 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl __swprintf_l(wchar_t *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__vswprintf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1414 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1435 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf(wchar_t *const _Buffer, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__vswprintf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1454 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl swprintf(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1474 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "__swprintf_l_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl __swprintf_l(wchar_t *_Buffer, wchar_t const *_Format, _locale_t _Locale,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vswprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl __vswprintf_l(wchar_t *_Buffer, wchar_t const *_Format, _locale_t _Locale, va_list _Args);__declspec(deprecated("This function or variable may be unsafe. Consider using " "swprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _swprintf(wchar_t *_Buffer, wchar_t const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "vswprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vswprintf(wchar_t *_Buffer, wchar_t const *_Format, va_list _Args);__inline int __cdecl _swprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1511 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl swprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1532 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 1534 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_p_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_p_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1562 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_p(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1582 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_c_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1603 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swprintf_c(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1623 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwprintf_l(wchar_t *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1646 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwprintf(wchar_t *_Buffer, size_t _BufferCount, wchar_t const *_Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1668 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwprintf_s_l(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1690 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwprintf_s(wchar_t *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1711 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf_l(wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1737 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf(wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_l(_Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1755 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf_p_l(wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_p_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1774 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _scwprintf_p(wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscwprintf_p_l(_Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1792 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #pragma warning(push) #pragma warning(disable:4141 6054) #pragma warning(pop) #line 1856 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" int __cdecl __stdio_common_vswscanf(unsigned __int64 _Options, wchar_t const *_Buffer, size_t _BufferCount, wchar_t const *_Format, _locale_t _Locale, va_list _ArgList);__inline int __cdecl _vswscanf_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options()), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1897 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswscanf(wchar_t const *_Buffer, wchar_t const *_Format, va_list _ArgList) { return _vswscanf_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 1912 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vswscanf_s_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1930 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl vswscanf_s(wchar_t const *const _Buffer, wchar_t const *const _Format, va_list _ArgList) { return _vswscanf_s_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 1947 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 1949 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnwscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnwscanf_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);} #line 1976 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _vsnwscanf_s_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vswscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList);} #line 1995 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_swscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _swscanf_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2015 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "swscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl swscanf(wchar_t const *const _Buffer, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2034 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _swscanf_s_l(wchar_t const *const _Buffer, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_s_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2054 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl swscanf_s(wchar_t const *const _Buffer, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vswscanf_s_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2075 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" #line 2077 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwscanf_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2100 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snwscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snwscanf(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2122 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwscanf_s_l(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2143 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __inline int __cdecl _snwscanf_s(wchar_t const *const _Buffer, size_t const _BufferCount, wchar_t const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnwscanf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2163 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstdio.h" __pragma(pack(pop))#pragma warning(pop) #pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) typedef __int64 fpos_t;errno_t __cdecl _get_stream_buffer_pointers(FILE *_Stream, char ***_Base, char ***_Pointer, int **_Count);errno_t __cdecl clearerr_s(FILE *_Stream);errno_t __cdecl fopen_s(FILE **_Stream, char const *_FileName, char const *_Mode);size_t __cdecl fread_s(void *_Buffer, size_t _BufferSize, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);errno_t __cdecl freopen_s(FILE **_Stream, char const *_FileName, char const *_Mode, FILE *_OldStream);char *__cdecl gets_s(char *_Buffer, rsize_t _Size);errno_t __cdecl tmpfile_s(FILE **_Stream);errno_t __cdecl tmpnam_s(char *_Buffer, rsize_t _Size);#line 145 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" void __cdecl clearerr(FILE *_Stream);int __cdecl fclose(FILE *_Stream);int __cdecl _fcloseall(void);FILE *__cdecl _fdopen(int _FileHandle, char const *_Mode);int __cdecl feof(FILE *_Stream);int __cdecl ferror(FILE *_Stream);int __cdecl fflush(FILE *_Stream);int __cdecl fgetc(FILE *_Stream);int __cdecl _fgetchar(void);int __cdecl fgetpos(FILE *_Stream, fpos_t *_Position);char *__cdecl fgets(char *_Buffer, int _MaxCount, FILE *_Stream);int __cdecl _fileno(FILE *_Stream);int __cdecl _flushall(void);__declspec(deprecated("This function or variable may be unsafe. Consider using " "fopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) FILE *__cdecl fopen(char const *_FileName, char const *_Mode);int __cdecl fputc(int _Character, FILE *_Stream);int __cdecl _fputchar(int _Character);int __cdecl fputs(char const *_Buffer, FILE *_Stream);size_t __cdecl fread(void *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);__declspec(deprecated("This function or variable may be unsafe. Consider using " "freopen_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) FILE *__cdecl freopen(char const *_FileName, char const *_Mode, FILE *_Stream);FILE *__cdecl _fsopen(char const *_FileName, char const *_Mode, int _ShFlag);int __cdecl fsetpos(FILE *_Stream, fpos_t const *_Position);int __cdecl fseek(FILE *_Stream, long _Offset, int _Origin);int __cdecl _fseeki64(FILE *_Stream, __int64 _Offset, int _Origin);long __cdecl ftell(FILE *_Stream);__int64 __cdecl _ftelli64(FILE *_Stream);size_t __cdecl fwrite(void const *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);int __cdecl getc(FILE *_Stream);int __cdecl getchar(void);int __cdecl _getmaxstdio(void);int __cdecl _getw(FILE *_Stream);void __cdecl perror(char const *_ErrorMessage);int __cdecl _pclose(FILE *_Stream);FILE *__cdecl _popen(char const *_Command, char const *_Mode);#line 344 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl putc(int _Character, FILE *_Stream);int __cdecl putchar(int _Character);int __cdecl puts(char const *_Buffer);int __cdecl _putw(int _Word, FILE *_Stream);int __cdecl remove(char const *_FileName);int __cdecl rename(char const *_OldFileName, char const *_NewFileName);int __cdecl _unlink(char const *_FileName);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_unlink" ". See online help for details.")) int __cdecl unlink(char const *_FileName);#line 391 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" void __cdecl rewind(FILE *_Stream);int __cdecl _rmtmp(void);__declspec(deprecated("This function or variable may be unsafe. Consider using " "setvbuf" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) void __cdecl setbuf(FILE *_Stream, char *_Buffer);int __cdecl _setmaxstdio(int _Maximum);int __cdecl setvbuf(FILE *_Stream, char *_Buffer, int _Mode, size_t _Size);__declspec(allocator) char *__cdecl _tempnam(char const *_DirectoryName, char const *_FilePrefix);__declspec(deprecated("This function or variable may be unsafe. Consider using " "tmpfile_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) FILE *__cdecl tmpfile(void);__declspec(deprecated("This function or variable may be unsafe. Consider using " "tmpnam_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl tmpnam(char *_Buffer);int __cdecl ungetc(int _Character, FILE *_Stream);void __cdecl _lock_file(FILE *_Stream);void __cdecl _unlock_file(FILE *_Stream);int __cdecl _fclose_nolock(FILE *_Stream);int __cdecl _fflush_nolock(FILE *_Stream);int __cdecl _fgetc_nolock(FILE *_Stream);int __cdecl _fputc_nolock(int _Character, FILE *_Stream);size_t __cdecl _fread_nolock(void *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);size_t __cdecl _fread_nolock_s(void *_Buffer, size_t _BufferSize, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);int __cdecl _fseek_nolock(FILE *_Stream, long _Offset, int _Origin);int __cdecl _fseeki64_nolock(FILE *_Stream, __int64 _Offset, int _Origin);long __cdecl _ftell_nolock(FILE *_Stream);__int64 __cdecl _ftelli64_nolock(FILE *_Stream);size_t __cdecl _fwrite_nolock(void const *_Buffer, size_t _ElementSize, size_t _ElementCount, FILE *_Stream);int __cdecl _getc_nolock(FILE *_Stream);int __cdecl _putc_nolock(int _Character, FILE *_Stream);int __cdecl _ungetc_nolock(int _Character, FILE *_Stream);int *__cdecl __p__commode(void);#line 596 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vfprintf(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vfprintf_s(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vfprintf_p(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _ArgList);__inline int __cdecl _vfprintf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfprintf((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList);} #line 648 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfprintf(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfprintf_l(_Stream, _Format,((void *) 0), _ArgList);} #line 662 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfprintf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfprintf_s((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList);} #line 677 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfprintf_s(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfprintf_s_l(_Stream, _Format,((void *) 0), _ArgList);} #line 693 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 695 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfprintf_p_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfprintf_p((*__local_stdio_printf_options()), _Stream, _Format, _Locale, _ArgList);} #line 710 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfprintf_p(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfprintf_p_l(_Stream, _Format,((void *) 0), _ArgList);} #line 724 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfprintf_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);} #line 738 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vprintf(char const *const _Format, va_list _ArgList) { return _vfprintf_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);} #line 751 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_s_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfprintf_s_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);} #line 765 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vprintf_s(char const *const _Format, va_list _ArgList) { return _vfprintf_s_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);} #line 780 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 782 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_p_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfprintf_p_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);} #line 796 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vprintf_p(char const *const _Format, va_list _ArgList) { return _vfprintf_p_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);} #line 809 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fprintf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 828 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl fprintf(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 846 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl _set_printf_count_output(int _Value);int __cdecl _get_printf_count_output(void);__inline int __cdecl _fprintf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 871 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl fprintf_s(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 891 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 893 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fprintf_p_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 912 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fprintf_p(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 930 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 948 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl printf(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 965 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_s_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 983 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl printf_s(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_s_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1002 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1004 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_p_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l((__acrt_iob_func(1)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1022 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _printf_p(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfprintf_p_l((__acrt_iob_func(1)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1039 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vfscanf(unsigned __int64 _Options, FILE *_Stream, char const *_Format, _locale_t _Locale, va_list _Arglist);__inline int __cdecl _vfscanf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfscanf((*__local_stdio_scanf_options()), _Stream, _Format, _Locale, _ArgList);} #line 1070 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfscanf(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfscanf_l(_Stream, _Format,((void *) 0), _ArgList);} #line 1084 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vfscanf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vfscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Stream, _Format, _Locale, _ArgList);} #line 1101 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vfscanf_s(FILE *const _Stream, char const *const _Format, va_list _ArgList) { return _vfscanf_s_l(_Stream, _Format,((void *) 0), _ArgList);} #line 1118 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1120 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscanf_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfscanf_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);} #line 1134 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vscanf(char const *const _Format, va_list _ArgList) { return _vfscanf_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);} #line 1147 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscanf_s_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vfscanf_s_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);} #line 1161 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vscanf_s(char const *const _Format, va_list _ArgList) { return _vfscanf_s_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);} #line 1176 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1178 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_fscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _fscanf_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1197 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "fscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl fscanf(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1215 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _fscanf_s_l(FILE *const _Stream, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l(_Stream, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1234 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl fscanf_s(FILE *const _Stream, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l(_Stream, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1254 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1256 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_scanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _scanf_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1274 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "scanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl scanf(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1291 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scanf_s_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l((__acrt_iob_func(0)), _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1309 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl scanf_s(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vfscanf_s_l((__acrt_iob_func(0)), _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1328 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1330 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vsprintf(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vsprintf_s(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vsnprintf_s(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, size_t _MaxCount, char const *_Format, _locale_t _Locale, va_list _ArgList);int __cdecl __stdio_common_vsprintf_p(unsigned __int64 _Options, char *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsnprintf_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1399 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1415 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsnprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options())|(1ULL<< 1), _Buffer, _BufferCount, _Format,((void *) 0), _ArgList);return _Result< 0 ? -1 :_Result;} #line 1446 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _vsprintf_l(char *const _Buffer, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return _vsnprintf_l(_Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 1462 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "vsprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl vsprintf(char *const _Buffer, char const *const _Format, va_list _ArgList) { return _vsnprintf_l(_Buffer,(size_t) -1, _Format,((void *) 0), _ArgList);} #line 1477 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsprintf_s_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1498 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsprintf_s(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1516 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1526 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsprintf_p_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf_p((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1547 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsprintf_p(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1563 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_s_l(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsnprintf_s((*__local_stdio_printf_options()), _Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1585 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_s(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);} #line 1602 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsnprintf_s(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);} #line 1630 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1641 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1659 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf(char const *const _Format, va_list _ArgList) { return _vscprintf_l(_Format,((void *) 0), _ArgList);} #line 1672 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf_p_l(char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf_p((*__local_stdio_printf_options())|(1ULL<< 1),((void *) 0), 0, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1690 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vscprintf_p(char const *const _Format, va_list _ArgList) { return _vscprintf_p_l(_Format,((void *) 0), _ArgList);} #line 1703 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_c_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { int const _Result=__stdio_common_vsprintf((*__local_stdio_printf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);return _Result< 0 ? -1 :_Result;} #line 1723 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsnprintf_c(char *const _Buffer, size_t const _BufferCount, char const *const _Format, va_list _ArgList) { return _vsnprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);} #line 1739 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_sprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _sprintf_l(char *const _Buffer, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1761 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl sprintf(char *const _Buffer, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1782 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "sprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl sprintf(char *_Buffer, char const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "vsprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl vsprintf(char *_Buffer, char const *_Format, va_list _Args);__inline int __cdecl _sprintf_s_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_s_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1810 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl sprintf_s(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_s_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1832 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 1834 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _sprintf_p_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_p_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1862 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _sprintf_p(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsprintf_p_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1882 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snprintf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snprintf_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1905 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl snprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=vsnprintf(_Buffer, _BufferCount, _Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1936 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf(_Buffer, _BufferCount, _Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1956 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl _snprintf(char *_Buffer, size_t _BufferCount, char const *_Format,...);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_vsnprintf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) int __cdecl _vsnprintf(char *_Buffer, size_t _BufferCount, char const *_Format, va_list _Args);__inline int __cdecl _snprintf_c_l(char *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_c_l(_Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 1986 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf_c(char *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_c_l(_Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2006 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf_s_l(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2028 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snprintf_s(char *const _Buffer, size_t const _BufferCount, size_t const _MaxCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsnprintf_s_l(_Buffer, _BufferCount, _MaxCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2049 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2075 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_l(_Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2092 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf_p_l(char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_p_l(_Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2110 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _scprintf_p(char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vscprintf_p(_Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2127 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" int __cdecl __stdio_common_vsscanf(unsigned __int64 _Options, char const *_Buffer, size_t _BufferCount, char const *_Format, _locale_t _Locale, va_list _ArgList);__inline int __cdecl _vsscanf_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vsscanf((*__local_stdio_scanf_options()), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 2158 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl vsscanf(char const *const _Buffer, char const *const _Format, va_list _ArgList) { return _vsscanf_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 2172 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _vsscanf_s_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale, va_list _ArgList) { return __stdio_common_vsscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer,(size_t) -1, _Format, _Locale, _ArgList);} #line 2189 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(push) #pragma warning(disable:6530) __inline int __cdecl vsscanf_s(char const *const _Buffer, char const *const _Format, va_list _ArgList) { return _vsscanf_s_l(_Buffer, _Format,((void *) 0), _ArgList);} #line 2208 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(pop) #line 2219 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_sscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _sscanf_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsscanf_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2238 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "sscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl sscanf(char const *const _Buffer, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsscanf_l(_Buffer, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2256 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _sscanf_s_l(char const *const _Buffer, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=_vsscanf_s_l(_Buffer, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2275 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl sscanf_s(char const *const _Buffer, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=vsscanf_s(_Buffer, _Format, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2297 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #line 2299 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(push) #pragma warning(disable:6530) __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snscanf_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snscanf_l(char const *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options()), _Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2326 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "_snscanf_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) __inline int __cdecl _snscanf(char const *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options()), _Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2349 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snscanf_s_l(char const *const _Buffer, size_t const _BufferCount, char const *const _Format, _locale_t const _Locale,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Locale))+((sizeof(_Locale)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format, _Locale, _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2374 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" __inline int __cdecl _snscanf_s(char const *const _Buffer, size_t const _BufferCount, char const *const _Format,...) { int _Result;va_list _ArgList;((void)(_ArgList=(va_list)(&(_Format))+((sizeof(_Format)+sizeof(int) - 1) &~(sizeof(int) - 1)))) ;_Result=__stdio_common_vsscanf((*__local_stdio_scanf_options())|(1ULL<< 0), _Buffer, _BufferCount, _Format,((void *) 0), _ArgList);((void)(_ArgList=(va_list) 0)) ;return _Result;} #line 2397 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h" #pragma warning(pop) __declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_tempnam" ". See online help for details.")) char *__cdecl tempnam(char const *_Directory, char const *_FilePrefix);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fcloseall" ". See online help for details.")) int __cdecl fcloseall(void);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fdopen" ". See online help for details.")) FILE *__cdecl fdopen(int _FileHandle, char const *_Format);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fgetchar" ". See online help for details.")) int __cdecl fgetchar(void);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fileno" ". See online help for details.")) int __cdecl fileno(FILE *_Stream);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_flushall" ". See online help for details.")) int __cdecl flushall(void);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_fputchar" ". See online help for details.")) int __cdecl fputchar(int _Ch);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_getw" ". See online help for details.")) int __cdecl getw(FILE *_Stream);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_putw" ". See online help for details.")) int __cdecl putw(int _Ch, FILE *_Stream);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_rmtmp" ". See online help for details.")) int __cdecl rmtmp(void);#line 2441 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\stdio.h"__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma once#pragma once#pragma once#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) int *__cdecl _errno(void);errno_t __cdecl _set_errno(int _Value);errno_t __cdecl _get_errno(int *_Value);unsigned long *__cdecl __doserrno(void);errno_t __cdecl _set_doserrno(unsigned long _Value);errno_t __cdecl _get_doserrno(unsigned long *_Value);__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4514 4820) __pragma(pack(push, 8)) void *__cdecl memchr(void const *_Buf, int _Val, size_t _MaxCount);int __cdecl memcmp(void const *_Buf1, void const *_Buf2, size_t _Size);void *__cdecl memcpy(void *_Dst, void const *_Src, size_t _Size);void *__cdecl memmove(void *_Dst, void const *_Src, size_t _Size);void *__cdecl memset(void *_Dst, int _Val, size_t _Size);char *__cdecl strchr(char const *_Str, int _Val);char *__cdecl strrchr(char const *_Str, int _Ch);char *__cdecl strstr(char const *_Str, char const *_SubStr);wchar_t *__cdecl wcschr(wchar_t const *_Str, wchar_t _Ch);wchar_t *__cdecl wcsrchr(wchar_t const *_Str, wchar_t _Ch);wchar_t *__cdecl wcsstr(wchar_t const *_Str, wchar_t const *_SubStr);__pragma(pack(pop))#pragma warning(pop) #pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) static __inline errno_t __cdecl memcpy_s(void *const _Destination, rsize_t const _DestinationSize, void const *const _Source, rsize_t const _SourceSize) { if(_SourceSize==0) { return 0;} { int _Expr_val=!!(_Destination !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;if(_Source==((void *) 0)||_DestinationSize< _SourceSize) { memset(_Destination, 0, _DestinationSize);{ int _Expr_val=!!(_Source !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;{ int _Expr_val=!!(_DestinationSize >=_SourceSize);if(!(_Expr_val)) {(*_errno())=34;_invalid_parameter_noinfo();return 34;} } ;return 22 ;} memcpy(_Destination, _Source, _SourceSize);return 0;} static __inline errno_t __cdecl memmove_s(void *const _Destination, rsize_t const _DestinationSize, void const *const _Source, rsize_t const _SourceSize) { if(_SourceSize==0) { return 0;} { int _Expr_val=!!(_Destination !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;{ int _Expr_val=!!(_Source !=((void *) 0));if(!(_Expr_val)) {(*_errno())=22;_invalid_parameter_noinfo();return 22;} } ;{ int _Expr_val=!!(_DestinationSize >=_SourceSize);if(!(_Expr_val)) {(*_errno())=34;_invalid_parameter_noinfo();return 34;} } ;memmove(_Destination, _Source, _SourceSize);return 0;}#pragma warning(pop) __pragma(pack(pop))#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) int __cdecl _memicmp(void const *_Buf1, void const *_Buf2, size_t _Size);int __cdecl _memicmp_l(void const *_Buf1, void const *_Buf2, size_t _Size, _locale_t _Locale);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_memccpy" ". See online help for details.")) void *__cdecl memccpy(void *_Dst, void const *_Src, int _Val, size_t _Size);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_memicmp" ". See online help for details.")) int __cdecl memicmp(void const *_Buf1, void const *_Buf2, size_t _Size);__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) errno_t __cdecl wcscat_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source);errno_t __cdecl wcscpy_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source);errno_t __cdecl wcsncat_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source, rsize_t _MaxCount);errno_t __cdecl wcsncpy_s(wchar_t *_Destination, rsize_t _SizeInWords, wchar_t const *_Source, rsize_t _MaxCount);wchar_t *__cdecl wcstok_s(wchar_t *_String, wchar_t const *_Delimiter, wchar_t **_Context);__declspec(allocator) wchar_t *__cdecl _wcsdup(wchar_t const *_String);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcscat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcscat(wchar_t *_Destination, wchar_t const *_Source);int __cdecl wcscmp(wchar_t const *_String1, wchar_t const *_String2);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcscpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcscpy(wchar_t *_Destination, wchar_t const *_Source);size_t __cdecl wcscspn(wchar_t const *_String, wchar_t const *_Control);size_t __cdecl wcslen(wchar_t const *_String);size_t __cdecl wcsnlen(wchar_t const *_Source, size_t _MaxCount);static __inline size_t __cdecl wcsnlen_s(wchar_t const *_Source, size_t _MaxCount) { return(_Source==0) ? 0 :wcsnlen(_Source, _MaxCount);}__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcsncat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcsncat(wchar_t *_Destination, wchar_t const *_Source, size_t _Count);int __cdecl wcsncmp(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcsncpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcsncpy(wchar_t *_Destination, wchar_t const *_Source, size_t _Count);wchar_t *__cdecl wcspbrk(wchar_t const *_String, wchar_t const *_Control);size_t __cdecl wcsspn(wchar_t const *_String, wchar_t const *_Control);__declspec(deprecated("This function or variable may be unsafe. Consider using " "wcstok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl wcstok(wchar_t *_String, wchar_t const *_Delimiter, wchar_t **_Context);#line 237 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\corecrt_wstring.h" __declspec(deprecated("This function or variable may be unsafe. Consider using " "wcstok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) static __inline wchar_t *__cdecl _wcstok(wchar_t *const _String, wchar_t const *const _Delimiter) { return wcstok(_String, _Delimiter, 0);} __declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcserror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcserror(int _ErrorNumber);errno_t __cdecl _wcserror_s(wchar_t *_Buffer, size_t _SizeInWords, int _ErrorNumber);__declspec(deprecated("This function or variable may be unsafe. Consider using " "__wcserror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl __wcserror(wchar_t const *_String);errno_t __cdecl __wcserror_s(wchar_t *_Buffer, size_t _SizeInWords, wchar_t const *_ErrorMessage);int __cdecl _wcsicmp(wchar_t const *_String1, wchar_t const *_String2);int __cdecl _wcsicmp_l(wchar_t const *_String1, wchar_t const *_String2, _locale_t _Locale);int __cdecl _wcsnicmp(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);int __cdecl _wcsnicmp_l(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount, _locale_t _Locale);errno_t __cdecl _wcsnset_s(wchar_t *_Destination, size_t _SizeInWords, wchar_t _Value, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsnset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsnset(wchar_t *_String, wchar_t _Value, size_t _MaxCount);wchar_t *__cdecl _wcsrev(wchar_t *_String);errno_t __cdecl _wcsset_s(wchar_t *_Destination, size_t _SizeInWords, wchar_t _Value);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsset(wchar_t *_String, wchar_t _Value);errno_t __cdecl _wcslwr_s(wchar_t *_String, size_t _SizeInWords);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcslwr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcslwr(wchar_t *_String);errno_t __cdecl _wcslwr_s_l(wchar_t *_String, size_t _SizeInWords, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcslwr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcslwr_l(wchar_t *_String, _locale_t _Locale);errno_t __cdecl _wcsupr_s(wchar_t *_String, size_t _Size);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsupr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsupr(wchar_t *_String);errno_t __cdecl _wcsupr_s_l(wchar_t *_String, size_t _Size, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_wcsupr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) wchar_t *__cdecl _wcsupr_l(wchar_t *_String, _locale_t _Locale);size_t __cdecl wcsxfrm(wchar_t *_Destination, wchar_t const *_Source, size_t _MaxCount);size_t __cdecl _wcsxfrm_l(wchar_t *_Destination, wchar_t const *_Source, size_t _MaxCount, _locale_t _Locale);int __cdecl wcscoll(wchar_t const *_String1, wchar_t const *_String2);int __cdecl _wcscoll_l(wchar_t const *_String1, wchar_t const *_String2, _locale_t _Locale);int __cdecl _wcsicoll(wchar_t const *_String1, wchar_t const *_String2);int __cdecl _wcsicoll_l(wchar_t const *_String1, wchar_t const *_String2, _locale_t _Locale);int __cdecl _wcsncoll(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);int __cdecl _wcsncoll_l(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount, _locale_t _Locale);int __cdecl _wcsnicoll(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);int __cdecl _wcsnicoll_l(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount, _locale_t _Locale);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsdup" ". See online help for details.")) wchar_t *__cdecl wcsdup(wchar_t const *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsicmp" ". See online help for details.")) int __cdecl wcsicmp(wchar_t const *_String1, wchar_t const *_String2);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsnicmp" ". See online help for details.")) int __cdecl wcsnicmp(wchar_t const *_String1, wchar_t const *_String2, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsnset" ". See online help for details.")) wchar_t *__cdecl wcsnset(wchar_t *_String, wchar_t _Value, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsrev" ". See online help for details.")) wchar_t *__cdecl wcsrev(wchar_t *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsset" ". See online help for details.")) wchar_t *__cdecl wcsset(wchar_t *_String, wchar_t _Value);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcslwr" ". See online help for details.")) wchar_t *__cdecl wcslwr(wchar_t *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsupr" ". See online help for details.")) wchar_t *__cdecl wcsupr(wchar_t *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_wcsicoll" ". See online help for details.")) int __cdecl wcsicoll(wchar_t const *_String1, wchar_t const *_String2);__pragma(pack(pop))#pragma warning(pop) #pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) __pragma(pack(push, 8)) errno_t __cdecl strcpy_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source);errno_t __cdecl strcat_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source);errno_t __cdecl strerror_s(char *_Buffer, size_t _SizeInBytes, int _ErrorNumber);errno_t __cdecl strncat_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source, rsize_t _MaxCount);errno_t __cdecl strncpy_s(char *_Destination, rsize_t _SizeInBytes, char const *_Source, rsize_t _MaxCount);char *__cdecl strtok_s(char *_String, char const *_Delimiter, char **_Context);void *__cdecl _memccpy(void *_Dst, void const *_Src, int _Val, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strcat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strcat(char *_Destination, char const *_Source);int __cdecl strcmp(char const *_Str1, char const *_Str2);int __cdecl _strcmpi(char const *_String1, char const *_String2);int __cdecl strcoll(char const *_String1, char const *_String2);int __cdecl _strcoll_l(char const *_String1, char const *_String2, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strcpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strcpy(char *_Destination, char const *_Source);size_t __cdecl strcspn(char const *_Str, char const *_Control);__declspec(allocator) char *__cdecl _strdup(char const *_Source);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strerror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strerror(char const *_ErrorMessage);errno_t __cdecl _strerror_s(char *_Buffer, size_t _SizeInBytes, char const *_ErrorMessage);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strerror_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strerror(int _ErrorMessage);int __cdecl _stricmp(char const *_String1, char const *_String2);int __cdecl _stricoll(char const *_String1, char const *_String2);int __cdecl _stricoll_l(char const *_String1, char const *_String2, _locale_t _Locale);int __cdecl _stricmp_l(char const *_String1, char const *_String2, _locale_t _Locale);size_t __cdecl strlen(char const *_Str);errno_t __cdecl _strlwr_s(char *_String, size_t _Size);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strlwr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strlwr(char *_String);errno_t __cdecl _strlwr_s_l(char *_String, size_t _Size, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strlwr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strlwr_l(char *_String, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strncat_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strncat(char *_Destination, char const *_Source, size_t _Count);int __cdecl strncmp(char const *_Str1, char const *_Str2, size_t _MaxCount);int __cdecl _strnicmp(char const *_String1, char const *_String2, size_t _MaxCount);int __cdecl _strnicmp_l(char const *_String1, char const *_String2, size_t _MaxCount, _locale_t _Locale);int __cdecl _strnicoll(char const *_String1, char const *_String2, size_t _MaxCount);int __cdecl _strnicoll_l(char const *_String1, char const *_String2, size_t _MaxCount, _locale_t _Locale);int __cdecl _strncoll(char const *_String1, char const *_String2, size_t _MaxCount);int __cdecl _strncoll_l(char const *_String1, char const *_String2, size_t _MaxCount, _locale_t _Locale);size_t __cdecl __strncnt(char const *_String, size_t _Count);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strncpy_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strncpy(char *_Destination, char const *_Source, size_t _Count);size_t __cdecl strnlen(char const *_String, size_t _MaxCount);static __inline size_t __cdecl strnlen_s(char const *_String, size_t _MaxCount) { return _String==0 ? 0 :strnlen(_String, _MaxCount);} errno_t __cdecl _strnset_s(char *_String, size_t _SizeInBytes, int _Value, size_t _MaxCount);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strnset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strnset(char *_Destination, int _Value, size_t _Count);char *__cdecl strpbrk(char const *_Str, char const *_Control);char *__cdecl _strrev(char *_Str);errno_t __cdecl _strset_s(char *_Destination, size_t _DestinationSize, int _Value);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strset_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strset(char *_Destination, int _Value);size_t __cdecl strspn(char const *_Str, char const *_Control);__declspec(deprecated("This function or variable may be unsafe. Consider using " "strtok_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl strtok(char *_String, char const *_Delimiter);errno_t __cdecl _strupr_s(char *_String, size_t _Size);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strupr_s" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strupr(char *_String);errno_t __cdecl _strupr_s_l(char *_String, size_t _Size, _locale_t _Locale);__declspec(deprecated("This function or variable may be unsafe. Consider using " "_strupr_s_l" " instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. " "See online help for details.")) char *__cdecl _strupr_l(char *_String, _locale_t _Locale);size_t __cdecl strxfrm(char *_Destination, char const *_Source, size_t _MaxCount);size_t __cdecl _strxfrm_l(char *_Destination, char const *_Source, size_t _MaxCount, _locale_t _Locale);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strdup" ". See online help for details.")) char *__cdecl strdup(char const *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strcmpi" ". See online help for details.")) int __cdecl strcmpi(char const *_String1, char const *_String2);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_stricmp" ". See online help for details.")) int __cdecl stricmp(char const *_String1, char const *_String2);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strlwr" ". See online help for details.")) char *__cdecl strlwr(char *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strnicmp" ". See online help for details.")) int __cdecl strnicmp(char const *_String1, char const *_String2, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strnset" ". See online help for details.")) char *__cdecl strnset(char *_String, int _Value, size_t _MaxCount);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strrev" ". See online help for details.")) char *__cdecl strrev(char *_String);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strset" ". See online help for details.")) char *__cdecl strset(char *_String, int _Value);__declspec(deprecated("The POSIX name for this item is deprecated. Instead, use the ISO C " "and C++ conformant name: " "_strupr" ". See online help for details.")) char *__cdecl strupr(char *_String);__pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4514 4820) __pragma(pack(push, 8)) __pragma(pack(pop))#pragma warning(pop) #pragma once#pragma warning(push)#pragma warning(disable:4324 4514 4574 4710 4793 4820 4995 4996 28719 28726 28727) typedef unsigned short _ino_t;typedef _ino_t ino_t;#line 24 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\sys/types.h" typedef unsigned int _dev_t;typedef _dev_t dev_t;#line 36 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\sys/types.h" typedef long _off_t;typedef _off_t off_t;#line 48 "C:/Program Files (x86)/Windows Kits/10/include/10.0.19041.0/ucrt\\sys/types.h"#pragma warning(pop) typedef char *sds;#pragma pack(push, 1) struct sdshdr5 { unsigned char flags;char buf[];};struct sdshdr8 { uint8_t len;uint8_t alloc;unsigned char flags;char buf[];};struct sdshdr16 { uint16_t len;uint16_t alloc;unsigned char flags;char buf[];};struct sdshdr32 { uint32_t len;uint32_t alloc;unsigned char flags;char buf[];};struct sdshdr64 { uint64_t len;uint64_t alloc;unsigned char flags;char buf[];};#pragma pack(pop) static inline size_t sdslen(const sds s) { unsigned char flags=s[-1];switch(flags &7) { case 0 :return((flags) >> 3) ;case 1 :return((struct sdshdr8 *)((s) -(sizeof(struct sdshdr8)))) ->len;case 2 :return((struct sdshdr16 *)((s) -(sizeof(struct sdshdr16)))) ->len;case 3 :return((struct sdshdr32 *)((s) -(sizeof(struct sdshdr32)))) ->len;case 4 :return((struct sdshdr64 *)((s) -(sizeof(struct sdshdr64)))) ->len;} return 0;}static inline size_t sdsavail(const sds s) { unsigned char flags=s[-1];switch(flags &7) { case 0 :{ return 0;} case 1 :{ struct sdshdr8 *sh=(void *)((s) -(sizeof(struct sdshdr8)));;return sh->alloc - sh->len;} case 2 :{ struct sdshdr16 *sh=(void *)((s) -(sizeof(struct sdshdr16)));;return sh->alloc - sh->len;} case 3 :{ struct sdshdr32 *sh=(void *)((s) -(sizeof(struct sdshdr32)));;return sh->alloc - sh->len;} case 4 :{ struct sdshdr64 *sh=(void *)((s) -(sizeof(struct sdshdr64)));;return sh->alloc - sh->len;} } return 0;}static inline void sdssetlen(sds s, size_t newlen) { unsigned char flags=s[-1];switch(flags &7) { case 0 :{ unsigned char *fp=((unsigned char *) s) - 1;*fp=0|(newlen<< 3);} break;case 1 :((struct sdshdr8 *)((s) -(sizeof(struct sdshdr8)))) ->len=(uint8_t) newlen;break;case 2 :((struct sdshdr16 *)((s) -(sizeof(struct sdshdr16)))) ->len=(uint16_t) newlen;break;case 3 :((struct sdshdr32 *)((s) -(sizeof(struct sdshdr32)))) -> len
Definition: CPAL.d:15583
cp
Definition: action.c:1035
int level
Definition: afm2pl.c:1694
#define loc
Definition: aptex-macros.h:65
#define name
#define null
Definition: aptex-macros.h:127
#define mode
Definition: aptex-macros.h:510
static integer interrupt
Definition: aptex.h:329
char *__cdecl strpbrk(char const *_Str, char const *_Control)
int rc
Definition: bmpfont.h:9
static int GetLastError(void)
Definition: call.c:26
Definition: Array.h:29
#define far
Definition: dd.h:143
BOOL
Definition: dd.h:100
@ FALSE
Definition: dd.h:101
@ TRUE
Definition: dd.h:102
#define free(a)
Definition: decNumber.cpp:310
int params
Definition: definitions.c:42
#define strrchr
Definition: detex.c:67
#define ENABLE_HARD_ERRORS
Definition: director.c:73
#define DISABLE_HARD_ERRORS
Definition: director.c:72
#define F_OK
Definition: defs.h:34
int v
Definition: dviconv.c:10
#define fopen
Definition: xxstdio.h:21
#define fread
Definition: xxstdio.h:25
#define fseek
Definition: xxstdio.h:30
static int pathlen
Definition: psspecial.c:35
int strcmp()
Definition: coll.cpp:143
int printf()
char * strcpy()
i32 Count[10]
Definition: dvibook.c:121
char * temp
Definition: dvidvi.c:137
#define error(a)
Definition: dviinfo.c:48
static void
Definition: fpif.c:118
mpz_t pp
Definition: gen-psqr.c:108
#define xp
#define sp1
#define s
Definition: afcover.h:80
SimBuffer::B Buffer
Definition: gensi.hpp:669
#define strchr
Definition: gsftopk.c:59
#define memcmp(s1, s2, n)
Definition: gsftopk.c:66
#define memcpy(d, s, n)
Definition: gsftopk.c:64
#define SEEK_SET
Definition: jmemansi.c:26
#define PATH_MAX
Definition: ftmac.c:91
#define NULL
Definition: ftobjs.h:61
small capitals from c petite p scientific f u
Definition: afcover.h:88
small capitals from c petite p
Definition: afcover.h:72
small capitals from c petite p scientific i
Definition: afcover.h:80
#define STARTDATA
Definition: cidparse.c:49
#define SEEK_END
Definition: ftzconf.h:251
void exit()
#define EOF
Definition: afmparse.c:59
struct NameRec_ * Name
#define Len
Definition: deflate.h:82
int atoi(const char *)
int errno
#define O_BINARY
Definition: config.h:393
#define unlink(file)
Definition: config.h:413
#define NO_ERROR
Definition: error.h:34
unsigned short USHORT
Definition: sfnt.h:36
USHORT Offset
Definition: tt_gsub.c:43
#define STDOUT_FILENO
Definition: c-unistd.h:53
#define STDERR_FILENO
Definition: c-unistd.h:54
#define STDIN_FILENO
Definition: c-unistd.h:52
#define fclose
Definition: debug.h:100
#define O_WRONLY
Definition: win32lib.h:179
#define lseek
Definition: win32lib.h:83
#define strnicmp
Definition: win32lib.h:96
#define access
Definition: win32lib.h:59
#define stricmp
Definition: win32lib.h:93
#define read
Definition: win32lib.h:88
#define O_RDONLY
Definition: win32lib.h:176
#define open
Definition: win32lib.h:86
#define close
Definition: win32lib.h:63
#define O_RDWR
Definition: win32lib.h:167
#define fputs
Definition: mendex.h:67
#define fprintf
Definition: mendex.h:64
static psfont * Environment
Definition: type1.c:155
static char * strerror(int errnum)
Definition: error.c:56
#define USHORT
Definition: ttf.h:11
#define string
Definition: ctangleboot.c:111
#define malloc
Definition: alloca.c:91
long clock_t
Definition: types.h:55
int strncmp()
unsigned short WORD
Definition: common.h:143
#define sprintf
Definition: snprintf.c:44
#define isdigit(c)
Definition: snprintf.c:177
static struct proto Ext[]
Definition: mkg3states.c:83
#define size_t
Definition: glob.c:257
#define LINE_MAX
Definition: mkind.h:326
unsigned int DWORD
Definition: mktexlib.h:49
#define _getdrive()
Definition: mktexlib.h:47
dictionary off
Definition: fc-lang.py:226
constexpr auto visit(Visitor &&visitor, Vs &&... vs) -> decltype((detail::all(lib::array< bool, sizeof...(Vs)>{{!vs.valueless_by_exception()...}}) ?(void) 0 :throw_bad_variant_access()), detail::visitation::variant::visit_value(lib::forward< Visitor >(visitor), lib::forward< Vs >(vs)...))
Definition: variant.hpp:2697
char msg[512]
Definition: nsfix.c:80
static const char * ErrorMessage
Definition: objects.c:788
union value value
Definition: obx.h:44
#define abs(a)
Definition: pbmplus.h:225
unsigned long ULONG
Definition: pdfgen.h:158
#define res(length)
Definition: picttoppm.c:287
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld endif[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld_src SRC pixld MASK if DST_R else pixld DST_R endif if
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
#define fp
static int size
Definition: ppmlabel.c:24
int r
Definition: ppmqvga.c:68
bstring c int memset(void *s, int c, int length)
static char sep[2]
Definition: pdftoppm.cc:115
#define isspace(ch)
Definition: utype.h:87
static char Output[]
Definition: luac.c:34
unsigned long QueryApplicationType(const char *)
Definition: ptype.c:49
static char **near FindNumberOfValues(char **, int *)
Definition: sh3.c:2053
void ClearExtendedLineFile(void)
Definition: sh3.c:1922
char * BuildOS2String(char **Array, char sep)
Definition: sh3.c:2433
#define PrintPidStarted()
Definition: sh3.c:172
static int near EnvironExecute(char **, int)
Definition: sh3.c:3041
struct SaveParameters SaveParameters
static Word_B * BCE_WordList
Definition: sh3.c:196
static int near ExtensionType(char *)
Definition: sh3.c:2621
static void near PrintLoadError(char *)
Definition: sh3.c:4036
static bool near SetUpIOHandlers(IO_Actions *, int, int)
Definition: sh3.c:1132
void BuildExtensionLists(void)
Definition: sh3.c:2527
static void near TrackAllCommands(char *, char *)
Definition: sh3.c:4598
#define InsertCharacterAtStart(a)
Definition: sh3.c:173
static int near XMS_Close(void)
Definition: sh3.c:1743
int CountNumberArguments(char **wp)
Definition: sh3.c:2081
static int near SpawnProcess(char **)
Definition: sh3.c:3083
static char * Swap_File
Definition: sh3.c:214
static bool near GetApplicationType(char *)
Definition: sh3.c:4616
static bool near Get_EMS_Driver(void)
Definition: sh3.c:1650
static int near SwapToMemory(int, char **)
Definition: sh3.c:2851
static bool near EMS_error(char *, int)
Definition: sh3.c:1723
static char * MS_emsg
Definition: sh3.c:211
static int is_64bit_exe(char *path)
Definition: sh3.c:4854
static char * Extend_file
Definition: sh3.c:183
static bool near SetUpCLI(char *, Word_B **)
Definition: sh3.c:4838
static int near ExecuteProgram(char *, char **, char **, int)
Definition: sh3.c:1382
static char * SwapFailed
Definition: sh3.c:213
char * GenerateFullExecutablePath(char *path)
Definition: sh3.c:1958
static char * MS_Space
Definition: sh3.c:212
void RestoreEnvironment(int retval, int stack)
Definition: sh3.c:1120
void ClearSwapFile(void)
Definition: sh3.c:1938
static bool near Get_XMS_Driver(void)
Definition: sh3.c:1593
static char **near BuildCommandEnvironment(void)
Definition: sh3.c:4057
static struct ExtType DefaultExtensions[]
static void near EchoCurrentCommand(char **)
Definition: sh3.c:1266
void PrintAList(int ArgCount, char **ArgList)
Definition: sh3.c:4516
static int near ForkAndExecute(C_Op *, int, int, int, char **, char **, char **)
Definition: sh3.c:858
static char * NoSwapFiles
Definition: sh3.c:210
static char * WildCards
Definition: sh3.c:185
static char * LIT_STARTWINP
Definition: sh3.c:189
static char ** ExecutableList
Definition: sh3.c:204
static int BCE_Length
Definition: sh3.c:197
static int near EMS_Close(void)
Definition: sh3.c:1758
static char ** ExecuteFunctionList
Definition: sh3.c:205
#define MAX_DEFAULT_EXTENSIONS
Definition: sh3.c:2495
static char * AE2big
Definition: sh3.c:181
static int near SetCommandReturnStatus(int)
Definition: sh3.c:1290
static int near ExecuteWindows(char *, char **, char **, int)
Definition: sh3.c:4739
static void near RestoreTheParameters(SaveParameters *)
Definition: sh3.c:3412
static void near SaveNumericParameters(char **, SaveParameters *)
Definition: sh3.c:3399
static char *near ConvertErrorNumber(void)
Definition: sh3.c:2807
int RunACommand(Source *s, char **params)
Definition: sh3.c:4123
static int near SwapToDiskError(int, char *)
Definition: sh3.c:2835
void RestoreCurrentDirectory(char *path)
Definition: sh3.c:840
static bool near XMS_error(char *, int)
Definition: sh3.c:1733
int ExecuteParseTree(C_Op *t, int StandardIN, int StandardOUT, int Actions)
Definition: sh3.c:265
int ExecuteACommand(char **argv, int mode)
Definition: sh3.c:1300
static char **near ProcessSpaceInParameters(char **)
Definition: sh3.c:3256
void CheckProgramMode(char *Pname, ExeMode *PMode)
Definition: sh3.c:2889
static int near LocalExecve(char **, char **, int)
Definition: sh3.c:1317
static bool near CheckParameterLength(char **)
Definition: sh3.c:3154
int FindLocationOfExecutable(char *FullPath, char *name)
Definition: sh3.c:2610
static bool near BadApplication(char *)
Definition: sh3.c:4725
static unsigned long ApplicationType
Definition: sh3.c:186
static unsigned int near CheckForCommonOptions(LineFields *, int)
Definition: sh3.c:3013
static int near BuildCommandLine(char *, char **, char **, int)
Definition: sh3.c:1790
static bool near WriteToExtendedFile(FILE *, char *)
Definition: sh3.c:2095
static int near ExecuteSpecialProcessor(char *, char **, char **, int, Word_B *)
Definition: sh3.c:4779
static int near ExecuteScriptFile(char *, char **, char **, int, bool)
Definition: sh3.c:2728
static void BuildEnvironmentEntry(const void *, VISIT, int)
Definition: sh3.c:4080
static int near StartTheProcess(char *, char **, char **, int)
Definition: sh3.c:2143
static int near CheckForExecOnly(char *, int, int)
Definition: sh3.c:1570
static char * DoubleQuotes
Definition: sh3.c:184
static bool near ExecuteFunction(char **, int *, bool)
Definition: sh3.c:3889
#define COMMON_FIELD_COUNT
Definition: sh3.c:245
static char *near FindFileAndExtension(char *, char *, char **)
Definition: sh3.c:2643
static int near CountDoubleQuotes(char *)
Definition: sh3.c:3382
char SUBExtension[]
Definition: sh6.c:236
static struct builtin builtin[]
Definition: sh7.c:3157