-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser.c
More file actions
799 lines (668 loc) · 29.8 KB
/
parser.c
File metadata and controls
799 lines (668 loc) · 29.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
#include "headers.h"
//make a struct of a command, which includes the command name, arguments, fg/bg status, input/output redirection
//check for >, >>, &, |, ;, and split up commands based on those
//then put the first string of the command as the command and store the rest as arguments
void Parse(char** strings, int* count, char* parsefilepath, char* invokeddir, char** pwd, int* timetaken, char* process)
{
//get current working directory
int currcount = *count;
int p_flag = 0;
//redirection definitions:
int redirect_flag = 0;
char* output_file = malloc(MAX_FILE_NAME);
output_file[0] = '\0';
char* input_file = malloc(MAX_FILE_NAME);
input_file[0] = '\0';
for(int i = 0; i < currcount; i++)
{
if(strcmp(strings[i], "pastevents") == 0)
{
if(i < *count - 1 && strcmp(strings[i + 1], "execute") == 0)
{
p_flag = 1;
}
}
}
if(p_flag == 1)
{
while(p_flag == 1)
{
for(int i = 0; i < *count; i++)
{
//printf("peloop %d\n", i);
if(strcmp(strings[i], "pastevents") == 0)
{
if(i < *count - 1 && strcmp(strings[i + 1], "execute") == 0)
{
Command cmd = malloc(sizeof(struct Command));
cmd->command = malloc(11);
cmd->command = "pastevents";
cmd->args = malloc(sizeof(char*)*(2 + 1));
cmd->args[0] = "execute";
cmd->index = i;
if(i < *count - 2)
{
cmd->args[1] = strings[i+2];
}
cmd->args[2] = malloc(2);
cmd->args[2][0] = '\0';
cmd->argcount = 2;
int numargs = 2;
// printf("A gonna evaluate %s\n", cmd->command);
strcpy(process, cmd->command);
// printf("process: %s, address: %p\n", process, &process);
EvaluateCmd(strings, count, parsefilepath, cmd, 1, invokeddir, pwd, numargs, timetaken, process, redirect_flag, input_file, output_file);
break;
}
}
}
p_flag = 0;
for(int i = 0; i < *count; i++)
{
if(strcmp(strings[i], "pastevents") == 0)
{
if(i < *count - 1 && strcmp(strings[i + 1], "execute") == 0)
{
p_flag = 1;
}
}
}
}
}
if(p_flag == 0)
{
int lastadd = 0;
// printf("count : %d\n", count);
//printf("to parse:\n");
int semioramp = 0;
int red = 0;
int pipe = 0;
for(int i = 0; i < *count; i++)
{
if(strcmp(strings[i], "&") == 0 || strcmp(strings[i], ";") == 0)
{
semioramp = 1;
}
else if (strcmp(strings[i], ">") == 0 || strcmp(strings[i], "<") == 0 || strcmp(strings[i], ">>") == 0)
{
red = 1;
}
else if(strcmp(strings[i], "|") == 0)
{
pipe = 1;
}
}
if(semioramp == 1)
{
for(int i = 0; i < *count; i++)
{
// printf("entered, i: %d, lastadd: %d\n", i, lastadd);
//printf("Parse loop index: %d\n", i);
for(int p = 0; p < *count; p++)
{
//printf("%s ", strings[p]);
}
//printf("\n");
int flag = 0;
// if(strcmp(strings[i], "<") == 0 || strcmp(strings[i], ">") == 0 || strcmp(strings[i], ">>") == 0 || strcmp(strings[i], "|") == 0 || strcmp(strings[i], "&") == 0 || strcmp(strings[i], ";") == 0)
// {
// printf("i: %d\n", i);
// printf("token: %s\n", strings[i]);
if(strcmp(strings[i], "&") == 0 || strcmp(strings[i], ";") == 0)
{
// printf("i: %d, lastadd: %d\n", i, lastadd);
for(int f = lastadd; f < i + lastadd; f++)
{
if(strcmp(strings[f], ">") == 0 || strcmp(strings[f], ">>") == 0 || strcmp(strings[f], "|") == 0 || strcmp(strings[f], "<") == 0)
{
printf("f: %d\n", f);
char** newstrings = malloc(sizeof(char*)*(i - lastadd));
int* newcount = malloc(sizeof(int*));
*newcount = i - lastadd;
for(int v = lastadd; v < i; v++)
{
newstrings[v - lastadd] = strings[v];
}
if(strcmp(strings[i], "&") == 0)
{
//put flag for bg
flag = 1;
SpecialParse(0, newstrings, newcount, parsefilepath, invokeddir, pwd, timetaken, process, pipe, red);
lastadd = i + 1;
printf("next up: %s\n", strings[i + 1]);
}
else
{
//flag for fg
flag = 1;
SpecialParse(1, newstrings, newcount, parsefilepath, invokeddir, pwd, timetaken, process, pipe, red);
lastadd = i + 1;
printf("next up: %s\n", strings[i + 1]);
}
break;
}
}
if(flag == 1)
{
continue;
}
Command cmd = malloc(sizeof(struct Command));
cmd->command = malloc(sizeof(char)*MAX_ARG_LEN);
int numargs = i - lastadd - 1;
if(i == lastadd)
{
lastadd++;
continue;
}
//printing debugging
//printf("index = %d\nstart = %d\nnumargs = %d\n", i, lastadd, numargs);
// for(int j = 0; j < numargs; j++)
// {
// cmd->args[j] = malloc(sizeof(char)*MAX_ARG_LEN);
// }
strcpy(cmd->command, strings[lastadd]);
//printing debugging
//printf("Cmd: '%s'\n", cmd->command);
cmd->args = malloc(sizeof(char*)*(numargs + 1)); //size of whole command is i - lastadd, so args are i - lastadd - 1
cmd->index = lastadd;
//printing debugging
//printf("index added: %d\n", cmd->index);
//printf("numargs = %d\n", numargs);
// if(numargs == 0)
// {
// cmd->args[0] = NULL;
// }
for(int p = lastadd + 1; p < i; p++)
{
cmd->args[p - lastadd - 1] = malloc(sizeof(char)*MAX_ARG_LEN);
cmd->args[p - lastadd - 1] = strings[p];
}
cmd->args[numargs] = malloc(2);
cmd->args[numargs][0] = '\0';
for(int p = 0; p < numargs; p++)
{
// printf("arg_%d: '%s'\n", p, cmd->args[p]);
}
cmd->argcount = numargs;
//done separating cmds and args
//printf("Going to evaluate %s\n", cmd->command);
//printf("redflag: %d\n", redirect_flag);
if(strcmp(strings[i], "&") == 0)
{
// printf("B gonna evaluate %s\n", cmd->command);
strcpy(process, cmd->command);
// printf("process: %s\n", process);
EvaluateCmd(strings, count, parsefilepath, cmd, 0, invokeddir, pwd, numargs, timetaken, process, redirect_flag, input_file, output_file); //bg
}
else
{
// printf("C gonna evaluate %s\n", cmd->command);
strcpy(process, cmd->command);
// printf("process: %s\n", process);
EvaluateCmd(strings, count, parsefilepath, cmd, 1, invokeddir, pwd, numargs, timetaken, process, redirect_flag, input_file, output_file); //fg
}
lastadd = i + 1; //ignore the delimiter
}
// else if(strcmp(strings[i], "<") == 0 || strcmp(strings[i], ">") == 0 || strcmp(strings[i], ">>") == 0)
// {
// //check if theres another arrow upccomming
// //if there is, do something different
// //if there isnt, continue with this
// //flag = 4 if theres both input and output
//
// }
else if (i == *count - 1)
{
if(lastadd <= i)
{
redirect_flag = 0;
// printf("LAST STRING i: %d, lastadd: %d\n", i, lastadd);
Command cmd = malloc(sizeof(struct Command));
cmd->args = malloc(sizeof(char*)*(i - lastadd + 1));
int numargs = i - lastadd;
//printf("index = %d\nstart = %d\nnumargs = %d\n", i, lastadd, numargs);
cmd->command = strings[lastadd];
cmd->index = lastadd;
//printf("index added: %d\n", cmd->index);
//printf("LALALA\n");
//printf("numargs = %d\n", numargs);
// if(numargs == 0)
// {
// cmd->args = malloc(sizeof(char*));
// cmd->args[0] = NULL;
// }
for(int p = lastadd + 1; p <= i; p++)
{
cmd->args[p - lastadd - 1] = malloc(sizeof(char)*MAX_ARG_LEN);
cmd->args[p - lastadd - 1] = strings[p];
// printf("%s\n", strings[p]);
}
cmd->argcount = numargs;
cmd->args[numargs] = malloc(2);
cmd->args[numargs][0] = '\0';
//printf("Cmd: '%s'\n", cmd->command);
for(int p = 0; p < numargs; p++)
{
// printf("arg_%d: '%s'\n", p, cmd->args[p]);
}
// printf("D gonna evaluate %s\n", cmd->command);
strcpy(process, cmd->command);
// printf("process: %s, address: %p\n", process, &process);
EvaluateCmd(strings, count, parsefilepath, cmd, 1, invokeddir, pwd, numargs, timetaken, process, redirect_flag, input_file, output_file); //fg
//printf("%s\n", pwd);
// printf("back at parser, process: %s, address: %p\n", process, &process);
}
}
}
}
else if(red == 1 || pipe == 1)
{
SpecialParse(0, strings, count, parsefilepath, invokeddir, pwd, timetaken, process, pipe, red);
}
else
{
for(int i = 0; i < *count; i ++)
{
if (i == *count - 1)
{
if(lastadd <= i)
{
redirect_flag = 0;
// printf("LAST STRING i: %d, lastadd: %d\n", i, lastadd);
Command cmd = malloc(sizeof(struct Command));
cmd->args = malloc(sizeof(char*)*(i - lastadd + 1));
int numargs = i - lastadd;
//printf("index = %d\nstart = %d\nnumargs = %d\n", i, lastadd, numargs);
cmd->command = strings[lastadd];
cmd->index = lastadd;
//printf("index added: %d\n", cmd->index);
//printf("LALALA\n");
//printf("numargs = %d\n", numargs);
// if(numargs == 0)
// {
// cmd->args = malloc(sizeof(char*));
// cmd->args[0] = NULL;
// }
for(int p = lastadd + 1; p <= i; p++)
{
cmd->args[p - lastadd - 1] = malloc(sizeof(char)*MAX_ARG_LEN);
cmd->args[p - lastadd - 1] = strings[p];
// printf("%s\n", strings[p]);
}
cmd->argcount = numargs;
cmd->args[numargs] = malloc(2);
cmd->args[numargs][0] = '\0';
//printf("Cmd: '%s'\n", cmd->command);
for(int p = 0; p < numargs; p++)
{
// printf("arg_%d: '%s'\n", p, cmd->args[p]);
}
// printf("D gonna evaluate %s\n", cmd->command);
strcpy(process, cmd->command);
// printf("process: %s, address: %p\n", process, &process);
EvaluateCmd(strings, count, parsefilepath, cmd, 1, invokeddir, pwd, numargs, timetaken, process, redirect_flag, input_file, output_file); //fg
//printf("%s\n", pwd);
// printf("back at parser, process: %s, address: %p\n", process, &process);
}
}
}
}
}
// }
//}
}
void SpecialParse(int flag, char** strings, int* count, char* parsefilepath, char* invokeddir, char** pwd, int* timetaken, char* process, int fpipe, int red)
{
if(fpipe == 1)
{
//separate strings based on pipe
// execute pipe loop and send each command strings to parser to execute
int lastadd = 0;
int pipe_count = 0;
for(int g = 0; g < *count; g++)
{
if(strcmp(strings[g], "|") == 0)
{
pipe_count++;
}
}
char*** Commands = malloc(sizeof(char**)*(pipe_count + 2));
for(int h = 0 ; h < pipe_count + 1; h++)
{
Commands[h] = calloc(MAX_ARGS, sizeof(char*));
}
int cmds = 0;
int cmdstrngs = 0;
for(int f = 0; f < *count; f++)
{
// printf("f: %d\n", f);
if(strcmp(strings[f], "|") == 0 || f == *count - 1)
{
int p = 0;
// printf("lastadd: %d, f: %d\n", lastadd, f);
for(int d = lastadd; d <= f && strcmp(strings[d], "|") != 0 ; d++)
{
// printf("d - lastadd: %d, cmd: %d\n", d - lastadd, cmds);
// Commands[cmds][d - lastadd] = calloc(MAX_ARG_LEN, 1);
Commands[cmds][d - lastadd] = strings[d];
// printf("command string added: %s, index: %d\n", Commands[cmds][d - lastadd], d - lastadd);
p = d;
}
Commands[cmds][p - lastadd + 1] = NULL;
cmds++;
lastadd = f + 1;
}
}
int standin = dup(STDIN_FILENO);
int standout = dup(STDOUT_FILENO);
size_t i, n;
int prev_pipe, pfds[2];
prev_pipe = STDIN_FILENO;
int arrcount = 0;
n = pipe_count + 1;
for (i = 0; i < n - 1; i++)
{
arrcount = 0;
for(int p = 0; Commands[i][p] != NULL; p++)
{
arrcount++;
// printf("arrcount: %d, string: %s\n", arrcount, Commands[i][p]);
}
int* newcnt = malloc(sizeof(int*));
*newcnt = arrcount;
pipe(pfds);
if (fork() == 0) {
// Redirect previous pipe to stdin
if (prev_pipe != STDIN_FILENO) {
dup2(prev_pipe, STDIN_FILENO);
close(prev_pipe);
}
// Redirect stdout to current pipe
dup2(pfds[1], STDOUT_FILENO);
close(pfds[1]);
// Start command
Parse(Commands[i], newcnt, parsefilepath, invokeddir, pwd, timetaken, process);
exit(EXIT_SUCCESS);
}
close(prev_pipe);
close(pfds[1]);
prev_pipe = pfds[0];
}
arrcount = 0;
for(int p = 0; Commands[n - 1][p] != NULL; p++)
{
arrcount++;
// printf("arrcount: %d, string: %s\n", arrcount, Commands[n - 1][p]);
}
int* newcnt = malloc(sizeof(int*));
*newcnt = arrcount;
// Get stdin from last pipe
if (prev_pipe != STDIN_FILENO) {
dup2(prev_pipe, STDIN_FILENO);
close(prev_pipe);
}
// Start last command
Parse(Commands[n - 1], newcnt, parsefilepath, invokeddir, pwd, timetaken, process);
close(pfds[0]);
close(pfds[1]);
dup2(standin, STDIN_FILENO);
close(standin);
dup2(standout, STDOUT_FILENO);
close(standout);
}
else if(fpipe == 0 && red == 1)
{
Command cmd = malloc(sizeof(struct Command));
cmd->command = malloc(sizeof(char)*MAX_ARG_LEN);
int evaled_both = 0;
flag = 1;
//redirection definitions:
int redirect_flag = 0;
char* output_file = malloc(MAX_FILE_NAME);
output_file[0] = '\0';
char* input_file = malloc(MAX_FILE_NAME);
input_file[0] = '\0';
int lastadd = 0;
int redirectpos = 0;
for(int i = 0; i < *count; i++)
{
if(strcmp(strings[i], ">") == 0 || strcmp(strings[i], ">>") == 0)
{
if(i + 1 < *count)
{
for(int k = i + 1; k < *count; k ++)
{
if(strcmp(strings[k], ">") == 0 || strcmp(strings[k], ">>") == 0)
{
//error
fprintf(stderr, RED"ERROR: Cannot handle multiple output redirections\n"reset);
return;
}
}
}
else
{
fprintf(stderr, RED"ERROR: No output file specified\n"reset);
return;
}
for(int k = i; k < *count; k ++)
{
if(strcmp(strings[k], "<") == 0)
{
//handle both in and output
if(i > 0)
{
// printf("inside k loop\n");
if(i + 2 < *count)
{
output_file = strings[i + 1];
// printf("outfile: %s\n", output_file);
// printf("next: %c\n", strings[i + 2][0]);
if(strings[i + 2][0] != '<')
{
// printf("hoe\n");
fprintf(stderr, RED"ERROR: Multiple output files not allowed\n"reset);
return;
}
int g = i;
g--;
while(g >= 0 && strcmp(strings[g], ";") != 0 && strcmp(strings[g], "&") != 0)
{
// printf("string[%d]: %s\n", g, strings[g]);
g--;
}
g++;
cmd->command = strings[g];
// printf("command: %s\n", cmd->command);
cmd->argcount = i - g - 1;
int numargs = cmd->argcount;
cmd->args = malloc(sizeof(char*)*(cmd->argcount + 1));
for(int h = g + 1; h < i; h++)
{
cmd->args[h - g - 1] = strings[h];
}
cmd->args[cmd->argcount] = malloc(2);
cmd->args[cmd->argcount][0] = '\0';
if(strcmp(strings[i], ">>") == 0)
{
redirect_flag = 4;
}
else
{
redirect_flag = 5;
}
if(i + 3 < *count)
{
input_file = strings[i + 3];
// printf("infile: %s\n", input_file);
}
else
{
fprintf(stderr, RED"ERROR: No input file specified\n"reset);
return;
}
strcpy(process, cmd->command);
EvaluateCmd(strings, count, parsefilepath, cmd, flag, invokeddir, pwd, numargs, timetaken, process, redirect_flag, input_file, output_file);
i = i + 4;
lastadd = i + 4;
evaled_both = 1;
// printf("came back to parser, i = %d\n", i);
return;
}
else
{
fprintf(stderr, RED"ERROR: No output file specified\n"reset);
return;
}
break;
}
}
redirectpos = i;
}
if(strcmp(strings[i], ">") == 0)
{
redirect_flag = 1;
}
else
{
redirect_flag = 2;
}
}
else if(strcmp(strings[i], ">>") == 0)
{
redirect_flag = 2;
redirectpos = i;
}
else if(strcmp(strings[i], "<") == 0)
{
redirectpos = i;
redirect_flag = 3;
if(i + 1 < *count)
{
for(int k = i + 1; k < *count; k ++)
{
if(strcmp(strings[k], "<") == 0)
{
//error
fprintf(stderr, RED"ERROR: Cannot handle multiple input files\n"reset);
return;
}
}
}
else
{
fprintf(stderr, RED"ERROR: No input file specified\n"reset);
return;
}
for(int k = i; k < *count; k ++)
{
if(strcmp(strings[k], ">") == 0 || strcmp(strings[k], ">>") == 0)
{
//handle both in and output
if(i > 0)
{
// printf("inside k loop\n");
if(i + 2 < *count)
{
input_file = strings[i + 1];
// printf("infile: %s\n", input_file);
// printf("next: %c\n", strings[i + 2][0]);
if(strings[i + 2][0] != '>')
{
// printf("hoe\n");
fprintf(stderr, RED"ERROR: Multiple input files not allowed\n"reset);
return;
}
int g = i;
g--;
while(g >= 0 && strcmp(strings[g], ";") != 0 && strcmp(strings[g], "&") != 0)
{
// printf("string[%d]: %s\n", g, strings[g]);
g--;
}
g++;
cmd->command = strings[g];
// printf("command: %s\n", cmd->command);
cmd->argcount = i - g - 1;
int numargs = cmd->argcount;
cmd->args = malloc(sizeof(char*)*(cmd->argcount + 1));
for(int h = g + 1; h < i; h++)
{
cmd->args[h - g - 1] = strings[h];
}
cmd->args[cmd->argcount] = malloc(2);
cmd->args[cmd->argcount][0] = '\0';
//set red flag
if(strcmp(strings[k], ">") == 0)
{
redirect_flag = 5;
}
else
{
redirect_flag = 4;
}
if(i + 3 < *count)
{
output_file = strings[i + 3];
// printf("outfile: %s\n", output_file);
}
else
{
fprintf(stderr, RED"ERROR: No output file specified\n"reset);
return;
}
// printf("redflag = %d\n", redirect_flag);
strcpy(process, cmd->command);
EvaluateCmd(strings, count, parsefilepath, cmd, flag, invokeddir, pwd, numargs, timetaken, process, redirect_flag, input_file, output_file);
i = i + 4;
lastadd = i + 4;
evaled_both = 1;
// printf("came back to parser, i = %d\n", i);
return;
}
else
{
fprintf(stderr, RED"ERROR: No input file specified\n"reset);
return;
}
break;
}
}
}
}
if(redirect_flag != 0)
{
if(redirect_flag == 1 || redirect_flag == 2)
{
strcpy(output_file, strings[redirectpos + 1]);
// printf("outfile: %s\n", output_file);
}
else
{
strcpy(input_file, strings[redirectpos + 1]);
// printf("infile: %s\n", input_file);
}
int g = redirectpos;
// printf("redirectpos = %d\n", redirectpos);
while(--g)
{
// printf("string[%d]: %s\n", g, strings[g]);
}
cmd->command = strings[g];
// printf("command: %s\n", cmd->command);
cmd->argcount = redirectpos - 1;
int numargs = cmd->argcount;
cmd->args = malloc(sizeof(char*)*(cmd->argcount + 1));
for(int h = g + 1; h < i; h++)
{
cmd->args[h - g - 1] = strings[h];
}
cmd->args[cmd->argcount] = malloc(2);
cmd->args[cmd->argcount][0] = '\0';
strcpy(process, cmd->command);
EvaluateCmd(strings, count, parsefilepath, cmd, flag, invokeddir, pwd, numargs, timetaken, process, redirect_flag, input_file, output_file);
return;
}
}
}
}