-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathakaiutil_main.c
4000 lines (3874 loc) · 125 KB
/
akaiutil_main.c
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
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) 2008-2019 Klaus Michael Indlekofer. All rights reserved.
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* akaiutil: access to AKAI S900/S1000/S3000 filesystems */
#include "akaiutil_io.h"
#include "akaiutil.h"
#include "akaiutil_tar.h"
#include "akaiutil_file.h"
#include "akaiutil_take.h"
#if (!defined(WIN32))&&(!defined(__CYGWIN__))
/* e.g. UNIX-like systems */
/* getopt */
#include <unistd.h>
extern int getopt(int argc,char * const argv[],const char *optstring);
extern char *optarg;
extern int optind;
extern int opterr;
extern int optopt;
#endif /* !WIN32 */
/* local directory/device */
#ifndef LCHDIR
#define LCHDIR(d) chdir(d)
#endif
#ifndef LDIR
#define LDIR system("ls -la");
#endif
void
print_progressbar(u_int end,u_int now)
{
static double xold; /* must be static */
if (end==0){
return;
}
if (now>end){
now=end;
}
if (now==0){
printf("0 20 40 60 80 100%%\n.");
xold=0.0;
}
for (;((double)now)/(double)end-xold>=0.02;xold+=0.02){
printf(".");
fflush(NULL);
}
}
void
usage(char *name)
{
if (name==NULL){
return;
}
#if defined(WIN32)||defined(__CYGWIN__)
fprintf(stderr,"usage: %s [-h] [-r] [-f] [-c <cdrom-nr> ...] [-p <physdrive-nr> ...] [<disk-file> ...]\n",name);
#else
fprintf(stderr,"usage: %s [-h] [-r] [-f] <disk-file> ...\n",name);
#endif
fprintf(stderr,"\t-h\tprint this info\n");
fprintf(stderr,"\t-r\tread-only mode\n");
fprintf(stderr,"\t-f\tenable floppy format\n");
#if defined(WIN32)||defined(__CYGWIN__)
fprintf(stderr,"\t-c\tCD-ROM drive\n");
fprintf(stderr,"\t-p\tphysical drive\n");
#endif
}
int
main(int argc, char **argv)
{
int op;
int errflag;
int readonly;
int floppyenable;
u_int i;
if (argc<=1){
usage(argv[0]);
exit(1);
}
readonly=0; /* R/W so far */
disk_num=0; /* no disks so far */
floppyenable=0; /* start with harddisk format only */
errflag=0;
#if defined(WIN32)||defined(__CYGWIN__)
#define OPT_STRING "hrfc:p:"
#else
#define OPT_STRING "hrf"
#endif
while ((op=getopt(argc,argv,OPT_STRING))!=EOF){
switch (op){
#if defined(WIN32)||defined(__CYGWIN__)
case 'c':
/* open CD-ROM drive */
sprintf(dirnamebuf,"\\\\.\\cdrom%i",atoi(optarg));
if (open_disk(dirnamebuf,1)<0){ /* 1: read-only */
exit(1);
}
break;
case 'p':
/* open physical drive, Note: use with care!!! */
sprintf(dirnamebuf,"\\\\.\\physicaldrive%i",atoi(optarg));
if (open_disk(dirnamebuf,readonly)<0){
exit(1);
}
break;
#endif
case 'h':
usage(argv[0]);
exit(0);
case 'r':
if ((!readonly)&&(disk_num>0)){ /* some disks already opened R/W ? */
fprintf(stderr,"-r option must be prior to any drive/disk-file arguments\n");
exit(1);
}
readonly=1; /* read-only mode */
break;
case 'f':
floppyenable=1; /* allow floppy format */
break;
case '?':
/* FALL THROUGH */
default:
errflag++;
}
}
if (errflag){
usage(argv[0]);
exit(1);
}
if (optind>argc){
usage(argv[0]);
exit(1);
}
/* open disk files */
for (;(optind<argc)&&(disk_num<DISK_NUM_MAX);optind++){
if (open_disk(argv[optind],readonly)<0){
exit(1);
}
}
printf("\n"
"****************************************************\n"
"* *\n"
"* AKAI S900/S1000/S3000 File Manager, Rev. 3.6.2 *\n"
"* *\n"
"****************************************************\n"
"\n");
printf("Copyright (c) 2008-2019 Klaus Michael Indlekofer. All rights reserved.\n\n");
#ifdef ADDITIONAL_COPYRIGHT_TEXT
printf(ADDITIONAL_COPYRIGHT_TEXT);
#endif /* ADDITIONAL_COPYRIGHT_TEXT */
printf("\n");
if (readonly){
printf("--- read-only mode ---\n\n");
}else{
printf("--- read/write mode ---\n\n");
}
main_restart: /* restart with opened disks */
/* init cache */
if (init_blk_cache()<0){
exit(1);
}
/* scan disks */
printf("\n");
part_num=0; /* no partitions found so far */
for (i=0;i<disk_num;i++){
printf("scanning disk%u\n",i);
if (akai_scan_disk(&disk[i],floppyenable)<0){
exit(1);
}
}
printf("\n");
/* print disks */
printf("\n");
akai_list_alldisks(0,NULL);
/* set current directory */
change_curdir_home(); /* ignore error */
/* clear filter tags */
akai_clear_filetag(curfiltertag,AKAI_FILE_TAGFREE); /* clear all */
fflush(NULL);
/* command interpreter */
{
#define CMDLEN 256 /* XXX */
char cmd[CMDLEN+1]; /* +1 for '\0' */
#define CMDTOKMAX 16
char *(cmdtok[CMDTOKMAX]);
int cmdtoknr;
int i;
char *p;
enum cmd_e{
CMD_HELP,
CMD_EXIT,
CMD_DINFO,
CMD_DF,
CMD_CD,
CMD_CDI,
CMD_DIR,
CMD_DIRREC,
CMD_LSTAGS,
CMD_INITTAGS,
CMD_RENTAG,
CMD_CDINFO,
CMD_VCDINFO,
CMD_SETCDINFO,
CMD_LCD,
CMD_LDIR,
CMD_LSFATI,
CMD_LSTFATI,
CMD_INFOI,
CMD_INFOALL,
CMD_TINFOI,
CMD_TINFOALL,
CMD_DEL,
CMD_DELI,
CMD_TDELI,
CMD_REN,
CMD_RENI,
CMD_SETOSVERI,
CMD_SETOSVERALL,
CMD_SETUNCOMPRI,
CMD_UPDATEUNCOMPRI,
CMD_UPDATEUNCOMPRALL,
CMD_SAMPLE900UNCOMPR,
CMD_SAMPLE900UNCOMPRI,
CMD_SAMPLE900UNCOMPRALL,
CMD_SAMPLE900COMPR,
CMD_SAMPLE900COMPRI,
CMD_SAMPLE900COMPRALL,
CMD_FIXRAMNAME,
CMD_FIXRAMNAMEI,
CMD_FIXRAMNAMEALL,
CMD_CLRTAGI,
CMD_CLRTAGALL,
CMD_SETTAGI,
CMD_SETTAGALL,
CMD_TRENI,
CMD_CLRFILTERTAG,
CMD_SETFILTERTAG,
CMD_COPY,
CMD_COPYI,
CMD_COPYVOL,
CMD_COPYVOLI,
CMD_COPYPART,
CMD_COPYTAGS,
CMD_WIPEVOL,
CMD_WIPEVOLI,
CMD_DELVOL,
CMD_DELVOLI,
CMD_FIXPART,
CMD_WIPEPART,
CMD_WIPEPART3CD,
CMD_FIXDISK,
CMD_FORMATFLOPPYL9,
CMD_FORMATFLOPPYL1,
CMD_FORMATFLOPPYL3,
CMD_FORMATFLOPPYH9,
CMD_FORMATFLOPPYH1,
CMD_FORMATFLOPPYH3,
CMD_FORMATHARDDISK9,
CMD_FORMATHARDDISK1,
CMD_FORMATHARDDISK3,
CMD_FORMATHARDDISK3CD,
CMD_GETDISK,
CMD_PUTDISK,
CMD_GETPART,
CMD_PUTPART,
CMD_GETTAGS,
CMD_PUTTAGS,
CMD_GETVOLPARAM,
CMD_PUTVOLPARAM,
CMD_RENVOL,
CMD_RENVOLI,
CMD_SETOSVERVOL,
CMD_SETOSVERVOLI,
CMD_SETLNUM,
CMD_SETLNUMI,
CMD_LSPARAM,
CMD_LSPARAMI,
CMD_INITPARAM,
CMD_INITPARAMI,
CMD_SETPARAM,
CMD_SETPARAMI,
CMD_GETPARAM,
CMD_GETPARAMI,
CMD_PUTPARAM,
CMD_PUTPARAMI,
CMD_GET,
CMD_GETI,
CMD_SAMPLE2WAV,
CMD_SAMPLE2WAVI,
CMD_SAMPLE2WAVALL,
CMD_PUT,
CMD_WAV2SAMPLE,
CMD_WAV2SAMPLE9,
CMD_WAV2SAMPLE9C,
CMD_WAV2SAMPLE1,
CMD_WAV2SAMPLE3,
CMD_TGETI,
CMD_TAKE2WAVI,
CMD_TAKE2WAVALL,
CMD_TPUT,
CMD_WAV2TAKE,
CMD_TARC,
CMD_TARCWAV,
CMD_TARX,
CMD_TARX9,
CMD_TARX1,
CMD_TARX3,
CMD_TARX3CD,
CMD_TARXWAV,
CMD_TARXWAV9,
CMD_TARXWAV9C,
CMD_TARXWAV1,
CMD_TARXWAV3,
CMD_MKVOL,
CMD_MKVOL9,
CMD_MKVOL1,
CMD_MKVOL3,
CMD_MKVOL3CD,
CMD_MKVOLI,
CMD_MKVOLI9,
CMD_MKVOLI1,
CMD_MKVOLI3,
CMD_MKVOLI3CD,
CMD_DIRCACHE,
CMD_NULL
};
enum cmd_e cmdnr;
struct cmdtab_s{
enum cmd_e cmdnr;
char *cmdstr;
int cmdtokmin;
int cmdtokmax;
char *cmduse;
char *cmdhelp;
}cmdtab[]={
{CMD_HELP,"help",1,2,"[<cmd>]","print help information for a command"},
{CMD_HELP,"man",1,2,NULL,NULL},
{CMD_EXIT,"exit",1,1,"","exit program"},
{CMD_EXIT,"quit",1,1,NULL,NULL},
{CMD_EXIT,"bye",1,1,NULL,NULL},
{CMD_EXIT,"q",1,1,NULL,NULL},
{CMD_DF,"df",1,1,"","print disk info"},
{CMD_DINFO,"dinfo",1,1,"","print current directory info"},
{CMD_DINFO,"pwd",1,1,NULL,NULL},
{CMD_CD,"cd",1,2,"[<path>]","change current directory"},
{CMD_CDI,"cdi",2,2,"<volume-index>","change current volume"},
{CMD_DIR,"dir",1,2,"[<path>]","list directory"},
{CMD_DIR,"ls",1,2,NULL,NULL},
{CMD_DIRREC,"dirrec",1,1,"","list current directory recursively"},
{CMD_DIRREC,"lsrec",1,1,NULL,NULL},
{CMD_LSTAGS,"lstags",1,1,"","list tags in partition"},
{CMD_LSTAGS,"dirtags",1,1,NULL,NULL},
{CMD_INITTAGS,"inittags",1,1,"","initialize tags of disk or partition"},
{CMD_RENTAG,"rentag",3,3,"<tag-index> <tag-name>","rename tag in partition"},
{CMD_CDINFO,"cdinfo",1,1,"","print CD3000 CD-ROM info"},
{CMD_VCDINFO,"vcdinfo",1,1,"","print verbose CD3000 CD-ROM info"},
{CMD_SETCDINFO,"setcdinfo",1,2,"[<cdlabel>]","set CD3000 CD-ROM info of disk or partition"},
{CMD_LCD,"lcd",2,2,"<dir-path>","change current local (external) directory"},
{CMD_LDIR,"ldir",1,1,"","list files in current local (external) directory"},
{CMD_LDIR,"lls",1,1,NULL,NULL},
{CMD_LSFATI,"lsfati",2,2,"<file-index>","print FAT of file"},
{CMD_LSTFATI,"lstfati",2,2,"<take-index>","print FAT of DD take"},
{CMD_INFOI,"infoi",2,2,"<file-index>","print information for file"},
{CMD_INFOALL,"infoall",1,1,"","print information for all files in current volume"},
{CMD_TINFOI,"tinfoi",2,2,"<take-index>","print information for DD take"},
{CMD_TINFOALL,"tinfoall",1,1,"","print information for all DD takes in current partition"},
{CMD_DEL,"del",2,2,"<file-path>","delete file"},
{CMD_DEL,"rm",2,2,NULL,NULL},
{CMD_DELI,"deli",2,2,"<file-index>","delete file"},
{CMD_DELI,"rmi",2,2,NULL,NULL},
{CMD_TDELI,"tdeli",2,2,"<take-index>","delete DD take"},
{CMD_TDELI,"trmi",2,2,NULL,NULL},
{CMD_REN,"ren",3,4,"<old-file-path> <new-file-path> [<new-file-index>]","rename/move file"},
{CMD_REN,"mv",3,4,NULL,NULL},
{CMD_RENI,"reni",3,4,"<old-file-index> <new-file-path> [<new-file-index>]","rename/move file"},
{CMD_RENI,"mvi",3,4,NULL,NULL},
{CMD_SETOSVERI,"setosveri",3,3,"<file-index> <new-os-version>","set OS version of file in S1000/S3000 volume"},
{CMD_SETOSVERALL,"setosverall",2,2,"<new-os-version>","set OS version of all files in current S1000/S3000 volume"},
{CMD_SETUNCOMPRI,"setuncompri",3,3,"<file-index> <new-uncompr>","set uncompr value of compressed file in S900 volume"},
{CMD_UPDATEUNCOMPRI,"updateuncompri",2,2,"<file-index>","update uncompr value of compressed file in S900 volume"},
{CMD_UPDATEUNCOMPRALL,"updateuncomprall",1,1,"","update uncompr value of all compressed files in current S900 volume"},
{CMD_SAMPLE900UNCOMPR,"sample900uncompr",2,3,"<file-path> [<dest-vol-path>]","uncompress S900 compressed sample file"},
{CMD_SAMPLE900UNCOMPR,"s9uncompr",2,3,NULL,NULL},
{CMD_SAMPLE900UNCOMPRI,"sample900uncompri",2,3,"<file-index> [<dest-vol-path>]","uncompress S900 compressed sample file"},
{CMD_SAMPLE900UNCOMPRI,"s9uncompri",2,3,NULL,NULL},
{CMD_SAMPLE900UNCOMPRALL,"sample900uncomprall",1,2,"[<dest-vol-path>]","uncompress all S900 compressed sample files in current volume"},
{CMD_SAMPLE900UNCOMPRALL,"s9uncomprall",1,2,NULL,NULL},
{CMD_SAMPLE900COMPR,"sample900compr",2,3,"<file-path> [<dest-vol-path>]","compress S900 non-compressed sample file"},
{CMD_SAMPLE900COMPR,"s9compr",2,3,NULL,NULL},
{CMD_SAMPLE900COMPRI,"sample900compri",2,3,"<file-index> [<dest-vol-path>]","compress S900 non-compressed sample file"},
{CMD_SAMPLE900COMPRI,"s9compri",2,3,NULL,NULL},
{CMD_SAMPLE900COMPRALL,"sample900comprall",1,2,"[<dest-vol-path>]","compress all S900 non-compressed sample files in current volume"},
{CMD_SAMPLE900COMPRALL,"s9comprall",1,2,NULL,NULL},
{CMD_FIXRAMNAME,"fixramname",2,2,"<file-path>","fix name in file header"},
{CMD_FIXRAMNAMEI,"fixramnamei",2,2,"<file-index>","fix name in file header"},
{CMD_FIXRAMNAMEALL,"fixramnameall",1,1,"","fix name in file header of all files in current volume"},
{CMD_CLRTAGI,"clrtagi",3,3,"<file-index> {<tag-index>|all}","untag file"},
{CMD_CLRTAGALL,"clrtagall",2,2,"{<tag-index>|all}","untag all files in current volume"},
{CMD_SETTAGI,"settagi",3,3,"<file-index> <tag-index>","tag file"},
{CMD_SETTAGALL,"settagall",2,2,"<tag-index>","tag all files in current volume"},
{CMD_TRENI,"treni",3,3,"<take-index> <new-name>","rename DD take"},
{CMD_TRENI,"tmvi",3,3,NULL,NULL},
{CMD_CLRFILTERTAG,"clrfiltertag",2,2,"{<tag-index>|all}","remove tag from file filter"},
{CMD_SETFILTERTAG,"setfiltertag",2,2,"<tag-index>","add tag to file filter"},
{CMD_COPY,"copy",3,4,"<src-file-path> <new-file-path> [<new-file-index>]","copy file"},
{CMD_COPY,"cp",3,4,NULL,NULL},
{CMD_COPYI,"copyi",3,4,"<src-file-index> <new-file-path> [<new-file-index>]","copy file"},
{CMD_COPYI,"cpi",3,4,NULL,NULL},
{CMD_COPYVOL,"copyvol",3,3,"<src-volume-path> <new-volume-path>","copy volume (with all of its files)"},
{CMD_COPYVOL,"cpvol",3,3,NULL,NULL},
{CMD_COPYVOLI,"copyvoli",3,3,"<src-volume-index> <new-volume-path>","copy volume (with all of its files)"},
{CMD_COPYVOLI,"cpvoli",3,3,NULL,NULL},
{CMD_COPYPART,"copypart",3,3,"<src-partition-path> <dst-partition-path>","copy all volumes of a partition"},
{CMD_COPYPART,"cppart",3,3,NULL,NULL},
{CMD_COPYTAGS,"copytags",3,3,"<src-partition-path> <dst-partition-path>","copy all tags of a partition"},
{CMD_COPYTAGS,"cptags",3,3,NULL,NULL},
{CMD_WIPEVOL,"wipevol",2,2,"<volume-path>","delete all files in volume"},
{CMD_WIPEVOL,"wipedir",2,2,NULL,NULL},
{CMD_WIPEVOL,"rmall",2,2,NULL,NULL},
{CMD_WIPEVOLI,"wipevoli",2,2,"<volume-index>","delete all files in volume"},
{CMD_WIPEVOLI,"wipediri",2,2,NULL,NULL},
{CMD_WIPEVOLI,"rmalli",2,2,NULL,NULL},
{CMD_DELVOL,"delvol",2,2,"<volume-path>","delete volume and all of its files"},
{CMD_DELVOL,"deldir",2,2,NULL,NULL},
{CMD_DELVOL,"rmvol",2,2,NULL,NULL},
{CMD_DELVOL,"rmdir",2,2,NULL,NULL},
{CMD_DELVOLI,"delvoli",2,2,"<volume-index>","delete volume and all of its files"},
{CMD_DELVOLI,"deldiri",2,2,NULL,NULL},
{CMD_DELVOLI,"rmvoli",2,2,NULL,NULL},
{CMD_DELVOLI,"rmdiri",2,2,NULL,NULL},
{CMD_FIXPART,"fixpart",2,2,"<partition-path>","fix partition"},
{CMD_WIPEPART,"wipepart",2,2,"<partition-path>","wipe partition"},
{CMD_WIPEPART3CD,"wipepart3cd",2,2,"<partition-path>","wipe partition for CD3000 CD-ROM"},
{CMD_FIXDISK,"fixdisk",2,3,"<disk-path> [<max-number>]"," fix disk"},
{CMD_FORMATFLOPPYL9,"formatfloppyl9",1,1,"","format low-density floppy for S900/S950"},
{CMD_FORMATFLOPPYL9,"formatfl9",1,1,NULL,NULL},
{CMD_FORMATFLOPPYL1,"formatfloppyl1",1,1,"","format low-density floppy for S1000"},
{CMD_FORMATFLOPPYL1,"formatfl1",1,1,NULL,NULL},
{CMD_FORMATFLOPPYL3,"formatfloppyl3",1,1,"","format low-density floppy for S3000"},
{CMD_FORMATFLOPPYL3,"formatfl3",1,1,NULL,NULL},
{CMD_FORMATFLOPPYH9,"formatfloppyh9",1,1,"","format high-density floppy for S950"},
{CMD_FORMATFLOPPYH9,"formatfh9",1,1,NULL,NULL},
{CMD_FORMATFLOPPYH1,"formatfloppyh1",1,1,"","format high-density floppy for S1000"},
{CMD_FORMATFLOPPYH1,"formatfh1",1,1,NULL,NULL},
{CMD_FORMATFLOPPYH3,"formatfloppyh3",1,1,"","format high-density floppy for S3000"},
{CMD_FORMATFLOPPYH3,"formatfh3",1,1,NULL,NULL},
{CMD_FORMATHARDDISK9,"formatharddisk9",1,2,"[<total-size>[M]]","format harddisk for S900/S950 (size in blocks or MB)"},
{CMD_FORMATHARDDISK9,"formathd9",1,2,NULL,NULL},
{CMD_FORMATHARDDISK1,"formatharddisk1",1,3,"[<part-size>[M] [<total-size>[M]]]","format harddisk for S1000 (size in blocks or MB)"},
{CMD_FORMATHARDDISK1,"formathd1",1,3,NULL,NULL},
{CMD_FORMATHARDDISK3,"formatharddisk3",1,3,"[<part-size>[M] [<total-size>[M]]]","format harddisk for S3000 or CD3000 (size in blocks or MB)"},
{CMD_FORMATHARDDISK3,"formathd3",1,3,NULL,NULL},
{CMD_FORMATHARDDISK3CD,"formatharddisk3cd",1,3,"[<part-size>[M] [<total-size>[M]]]","format harddisk for CD3000 CD-ROM (size in blocks or MB)"},
{CMD_FORMATHARDDISK3CD,"formatcd",1,3,NULL,NULL},
{CMD_GETDISK,"getdisk",2,2,"<file-name>","get disk (to external file)"},
{CMD_GETDISK,"dget",2,2,NULL,NULL},
{CMD_GETDISK,"dexport",2,2,NULL,NULL},
{CMD_PUTDISK,"putdisk",2,2,"<file-name>","put disk (from external file)"},
{CMD_PUTDISK,"dput",2,2,NULL,NULL},
{CMD_PUTDISK,"dimport",2,2,NULL,NULL},
{CMD_GETPART,"getpart",3,3,"<partition-path> <file-name>","get partition (to external file)"},
{CMD_GETPART,"pget",3,3,NULL,NULL},
{CMD_GETPART,"pexport",3,3,NULL,NULL},
{CMD_PUTPART,"putpart",3,3,"<file-name> <partition-path>","put partition (from external file)"},
{CMD_PUTPART,"pput",3,3,NULL,NULL},
{CMD_PUTPART,"pimport",3,3,NULL,NULL},
{CMD_GETTAGS,"gettags",2,2,"<file-name>","get tags from partition (to external file)"},
{CMD_GETTAGS,"tagsget",2,2,NULL,NULL},
{CMD_GETTAGS,"tagsexport",2,2,NULL,NULL},
{CMD_PUTTAGS,"puttags",2,2,"<file-name>","put tags to partition (from external file)"},
{CMD_PUTTAGS,"tagsput",2,2,NULL,NULL},
{CMD_PUTTAGS,"tagsimport",2,2,NULL,NULL},
{CMD_RENVOL,"renvol",3,3,"<old-path> <new-name>","rename volume"},
{CMD_RENVOL,"rendir",3,3,NULL,NULL},
{CMD_RENVOL,"mvvol",3,3,NULL,NULL},
{CMD_RENVOL,"mvdir",3,3,NULL,NULL},
{CMD_RENVOLI,"renvoli",3,3,"<volume-index> <new-name>","rename volume"},
{CMD_RENVOLI,"rendiri",3,3,NULL,NULL},
{CMD_RENVOLI,"mvvoli",3,3,NULL,NULL},
{CMD_RENVOLI,"mvdiri",3,3,NULL,NULL},
{CMD_SETOSVERVOL,"setosvervol",2,2,"<new-os-version>","set OS version of current volume"},
{CMD_SETOSVERVOLI,"setosvervoli",3,3,"<volume-index> <new-os-version>","set OS version of volume"},
{CMD_SETLNUM,"setlnum",2,2,"<new-load-number>","set load number of current volume (OFF for none)"},
{CMD_SETLNUMI,"setlnumi",3,3,"<volume-index> <new-load-number>","set load number of volume (OFF for none)"},
{CMD_LSPARAM,"lsparam",1,1,"","list parameters in current volume"},
{CMD_LSPARAMI,"lsparami",2,2,"<volume-index>","list parameters in volume"},
{CMD_INITPARAM,"initparam",1,1,"","initialize parameters in current volume"},
{CMD_INITPARAMI,"initparami",2,2,"<volume-index>","initialize parameters in volume"},
{CMD_SETPARAM,"setparam",3,3,"<par-index> <par-value>","set parameters in current volume"},
{CMD_SETPARAMI,"setparami",4,4,"<volume-index> <par-index> <par-value>","set parameters in volume"},
{CMD_GETPARAM,"getparam",2,2,"<file-name>","get parameters from current volume (to external file)"},
{CMD_GETPARAM,"paramget",2,2,NULL,NULL},
{CMD_GETPARAM,"paramexport",2,2,NULL,NULL},
{CMD_GETPARAMI,"getparami",3,3,"<volume-index> <file-name>","get parameters from volume (to external file)"},
{CMD_GETPARAMI,"paramgeti",3,3,NULL,NULL},
{CMD_GETPARAMI,"paramexporti",3,3,NULL,NULL},
{CMD_PUTPARAM,"putparam",2,2,"<file-name>","put parameters to current volume (from external file)"},
{CMD_PUTPARAM,"paramput",2,2,NULL,NULL},
{CMD_PUTPARAM,"paramimport",2,2,NULL,NULL},
{CMD_PUTPARAMI,"putparami",3,3,"<volume-index> <file-name>","put parameters to volume (from external file)"},
{CMD_PUTPARAMI,"paramputi",3,3,NULL,NULL},
{CMD_PUTPARAMI,"paramimporti",3,3,NULL,NULL},
{CMD_GET,"get",2,4,"<file-path> [<begin-byte> [<end-byte>]]","get file (to external)"},
{CMD_GET,"export",2,4,NULL,NULL},
{CMD_GETI,"geti",2,4,"<file-index> [<begin-byte> [<end-byte>]]","get file (to external)"},
{CMD_GETI,"exporti",2,4,NULL,NULL},
{CMD_SAMPLE2WAV,"sample2wav",2,2,"<file-path>","convert sample file into external WAV file"},
{CMD_SAMPLE2WAV,"s2wav",2,2,NULL,NULL},
{CMD_SAMPLE2WAV,"getwav",2,2,NULL,NULL},
{CMD_SAMPLE2WAVI,"sample2wavi",2,2,"<file-index>","convert sample file into external WAV file"},
{CMD_SAMPLE2WAVI,"s2wavi",2,2,NULL,NULL},
{CMD_SAMPLE2WAVI,"getwavi",2,2,NULL,NULL},
{CMD_SAMPLE2WAVALL,"sample2wavall",1,1,NULL,"convert all sample files into external WAV files"},
{CMD_SAMPLE2WAVALL,"s2wavall",1,1,NULL,NULL},
{CMD_SAMPLE2WAVALL,"getwavall",1,1,NULL,NULL},
{CMD_PUT,"put",2,3,"<file-name> [<file-index>]","put file (from external)"},
{CMD_PUT,"import",2,3,NULL,NULL},
{CMD_WAV2SAMPLE,"wav2sample",2,3,"<wav-file> [<file-index>]","convert external WAV file into sample file"},
{CMD_WAV2SAMPLE,"wav2s",2,3,NULL,NULL},
{CMD_WAV2SAMPLE,"putwav",2,3,NULL,NULL},
{CMD_WAV2SAMPLE9,"wav2sample9",2,3,"<wav-file> [<file-index>]","convert external WAV file into S900 non-compressed sample file"},
{CMD_WAV2SAMPLE9,"wav2s9",2,3,NULL,NULL},
{CMD_WAV2SAMPLE9,"putwav9",2,3,NULL,NULL},
{CMD_WAV2SAMPLE9C,"wav2sample9c",2,3,"<wav-file> [<file-index>]","convert external WAV file into S900 compressed sample file"},
{CMD_WAV2SAMPLE9C,"wav2s9c",2,3,NULL,NULL},
{CMD_WAV2SAMPLE9C,"putwav9c",2,3,NULL,NULL},
{CMD_WAV2SAMPLE1,"wav2sample1",2,3,"<wav-file> [<file-index>]","convert external WAV file into S1000 sample file"},
{CMD_WAV2SAMPLE1,"wav2s1",2,3,NULL,NULL},
{CMD_WAV2SAMPLE1,"putwav1",2,3,NULL,NULL},
{CMD_WAV2SAMPLE3,"wav2sample3",2,3,"<wav-file> [<file-index>]","convert external WAV file into S3000 sample file"},
{CMD_WAV2SAMPLE3,"wav2s3",2,3,NULL,NULL},
{CMD_WAV2SAMPLE3,"putwav3",2,3,NULL,NULL},
{CMD_TGETI,"tgeti",2,2,"<take-index>","get DD take (to external)"},
{CMD_TGETI,"texporti",2,2,NULL,NULL},
{CMD_TAKE2WAVI,"take2wavi",2,2,"<take-index>","convert DD take into external WAV file"},
{CMD_TAKE2WAVI,"t2wavi",2,2,NULL,NULL},
{CMD_TAKE2WAVI,"tgetwavi",2,2,NULL,NULL},
{CMD_TAKE2WAVI,"getwavti",2,2,NULL,NULL},
{CMD_TAKE2WAVALL,"take2wavall",1,1,NULL,"convert all DD takes into external WAV files"},
{CMD_TAKE2WAVALL,"t2wavall",1,1,NULL,NULL},
{CMD_TAKE2WAVALL,"tgetwavall",1,1,NULL,NULL},
{CMD_TAKE2WAVALL,"getwavtall",1,1,NULL,NULL},
{CMD_TPUT,"tput",2,2,"<file-name>","put DD take (from external)"},
{CMD_TPUT,"timport",2,2,NULL,NULL},
{CMD_WAV2TAKE,"wav2take",2,2,"<wav-name>","convert external WAV file into DD take"},
{CMD_WAV2TAKE,"wav2t",2,2,NULL,NULL},
{CMD_WAV2TAKE,"tputwav",2,2,NULL,NULL},
{CMD_WAV2TAKE,"putwavt",2,2,NULL,NULL},
{CMD_TARC,"tarc",2,2,"<tar-file>","tar c from current directory (to external)"},
{CMD_TARC,"target",2,2,NULL,NULL},
{CMD_TARC,"gettar",2,2,NULL,NULL},
{CMD_TARCWAV,"tarcwav",2,2,"<tar-file>","tar c from current directory (to external) with WAV conversion"},
{CMD_TARCWAV,"targetwav",2,2,NULL,NULL},
{CMD_TARCWAV,"gettarwav",2,2,NULL,NULL},
{CMD_TARX,"tarx",2,2,"<tar-file>","tar x in current directory (from external)"},
{CMD_TARX,"tarput",2,2,NULL,NULL},
{CMD_TARX,"puttar",2,2,NULL,NULL},
{CMD_TARX9,"tarx9",2,2,"<tar-file>","tar x in current directory (from external) for S900"},
{CMD_TARX9,"tarput9",2,2,NULL,NULL},
{CMD_TARX9,"puttar9",2,2,NULL,NULL},
{CMD_TARX1,"tarx1",2,2,"<tar-file>","tar x in current directory (from external) for S1000"},
{CMD_TARX1,"tarput1",2,2,NULL,NULL},
{CMD_TARX1,"puttar1",2,2,NULL,NULL},
{CMD_TARX3,"tarx3",2,2,"<tar-file>","tar x in current directory (from external) for S3000 or CD3000"},
{CMD_TARX3,"tarput3",2,2,NULL,NULL},
{CMD_TARX3,"puttar3",2,2,NULL,NULL},
{CMD_TARX3CD,"tarx3cd",2,2,"<tar-file>","tar x in current directory (from external) for CD3000 CD-ROM"},
{CMD_TARX3CD,"tarput3cd",2,2,NULL,NULL},
{CMD_TARX3CD,"puttar3cd",2,2,NULL,NULL},
{CMD_TARXWAV,"tarxwav",2,2,"<tar-file>","tar x in current directory (from external) with WAV conversion"},
{CMD_TARXWAV,"tarputwav",2,2,NULL,NULL},
{CMD_TARXWAV,"puttarwav",2,2,NULL,NULL},
{CMD_TARXWAV9,"tarxwav9",2,2,"<tar-file>","tar x in current directory (from external) with WAV conversion to S900 compressed sample"},
{CMD_TARXWAV9,"tarputwav9",2,2,NULL,NULL},
{CMD_TARXWAV9,"puttarwav9",2,2,NULL,NULL},
{CMD_TARXWAV9C,"tarxwav9c",2,2,"<tar-file>","tar x in current directory (from external) with WAV conversion to S900 compressed sample"},
{CMD_TARXWAV9C,"tarputwav9c",2,2,NULL,NULL},
{CMD_TARXWAV9C,"puttarwav9c",2,2,NULL,NULL},
{CMD_TARXWAV1,"tarxwav1",2,2,"<tar-file>","tar x in current directory (from external) with WAV conversion to S1000 sample"},
{CMD_TARXWAV1,"tarputwav1",2,2,NULL,NULL},
{CMD_TARXWAV1,"puttarwav1",2,2,NULL,NULL},
{CMD_TARXWAV3,"tarxwav3",2,2,"<tar-file>","tar x in current directory (from external) with WAV conversion to S3000 sample"},
{CMD_TARXWAV3,"tarputwav3",2,2,NULL,NULL},
{CMD_TARXWAV3,"puttarwav3",2,2,NULL,NULL},
{CMD_MKVOL,"mkvol",1,2,"[<volume-path>]","create new volume"},
{CMD_MKVOL,"mkdir",1,2,NULL,NULL},
{CMD_MKVOL9,"mkvol9",1,2,"[<volume-path>]","create new volume for S900"},
{CMD_MKVOL9,"mkdir9",1,2,NULL,NULL},
{CMD_MKVOL1,"mkvol1",1,3,"[<volume-path> [<load-number>]]","create new volume for S1000"},
{CMD_MKVOL1,"mkdir1",1,3,NULL,NULL},
{CMD_MKVOL3,"mkvol3",1,3,"[<volume-path> [<load-number>]]","create new volume for S3000 or CD3000"},
{CMD_MKVOL3,"mkdir3",1,3,NULL,NULL},
{CMD_MKVOL3CD,"mkvol3cd",1,3,"[<volume-path> [<load-number>]]","create new volume for CD3000 CD-ROM"},
{CMD_MKVOL3CD,"mkdir3cd",1,3,NULL,NULL},
{CMD_MKVOLI,"mkvoli",2,3,"<volume-index> [<volume-name>]","create new volume at index"},
{CMD_MKVOLI,"mkdiri",2,3,NULL,NULL},
{CMD_MKVOLI9,"mkvoli9",2,3,"<volume-index> [<volume-name>]","create new volume for S900 at index"},
{CMD_MKVOLI9,"mkdiri9",2,3,NULL,NULL},
{CMD_MKVOLI1,"mkvoli1",2,4,"<volume-index> [<volume-name> [<load-number>]]","create new volume for S1000 at index"},
{CMD_MKVOLI1,"mkdiri1",2,4,NULL,NULL},
{CMD_MKVOLI3,"mkvoli3",2,4,"<volume-index> [<volume-name> [<load-number>]]","create new volume for S3000 or CD3000 at index"},
{CMD_MKVOLI3,"mkdiri3",2,4,NULL,NULL},
{CMD_MKVOLI3CD,"mkvoli3cd",2,4,"<volume-index> [<volume-name> [<load-number>]]","create new volume for CD3000 CD-ROM at index"},
{CMD_MKVOLI3CD,"mkdiri3cd",2,4,NULL,NULL},
{CMD_DIRCACHE,"dircache",1,1,"","print cache information"},
{CMD_DIRCACHE,"lscache",1,1,NULL,NULL},
{CMD_NULL,NULL,0,0,NULL,NULL}
};
printf("\ntry \"help\" for infos\n\n");
for (;;){
/* get command */
curdir_info(0);
printf(" > ");
fflush(NULL);
fgets(cmd,CMDLEN,stdin);
if (strlen(cmd)==0){
goto main_parser_next;
}
cmd[strlen(cmd)-1]='\0';
if (strlen(cmd)==0){
goto main_parser_next;
}
/* parse command line */
for (i=0;i<CMDTOKMAX;i++){
if (i==0){
p=(char *)strtok(cmd," \t");
if (p==NULL){
/* no tokens at all */
goto main_parser_next;
}
cmdtok[i]=p;
}else{
p=(char *)strtok(NULL," \t");
if (p==NULL){
/* done */
break; /* parse command line loop */
}
cmdtok[i]=p;
}
}
cmdtoknr=i; /* number of tokens */
#ifdef DEBUGPARSER
printf("parser: cmdtoknr: %i\n",cmdtoknr);
for (i=0;i<cmdtoknr;i++){
printf("%i: \"%s\"\n",i,cmdtok[i]);
}
printf("\n");
#endif
/* find command */
cmdnr=CMD_NULL; /* nothing found yet */
for (i=0;cmdtab[i].cmdnr!=CMD_NULL;i++){
if (cmdtab[i].cmdstr!=NULL){
if (strcmp(cmdtab[i].cmdstr,cmdtok[0])==0){
/* found command string */
cmdnr=cmdtab[i].cmdnr;
break; /* done */
}
}
}
/* check number of arguments */
if ((cmdnr!=CMD_NULL)&&((cmdtoknr<cmdtab[i].cmdtokmin)||(cmdtoknr>cmdtab[i].cmdtokmax))){
for (i=0;cmdtab[i].cmdnr!=CMD_NULL;i++){
if ((cmdtab[i].cmdnr==cmdnr)&&(cmdtab[i].cmdstr!=NULL)&&(cmdtab[i].cmduse!=NULL)){
printf("usage: %s %s\n\n",cmdtab[i].cmdstr,cmdtab[i].cmduse);
break;
}
}
goto main_parser_next;
}
/* execute command */
switch (cmdnr){
case CMD_EXIT:
flush_blk_cache(); /* XXX if error, too late */
exit(0);
case CMD_HELP:
if (cmdtoknr==1){
int i,j,k;
printf("\ncommands:\n");
k=0;
for (i=0,j=0;cmdtab[i].cmdnr!=CMD_NULL;i++){
if (cmdtab[i].cmdstr!=NULL){
if (j%5==0){
putchar('\n');
k=0;
}
for (;k<((j%5)*15+2);k++){
putchar(' ');
}
printf("%s ",cmdtab[i].cmdstr);
k+=(int)strlen(cmdtab[i].cmdstr)+1;
j++;
}
}
printf("\n\ntry \"help <cmd>\" for more information about <cmd>\n\n");
}else if (cmdtoknr==2){
int i,flag;
/* find command */
cmdnr=CMD_NULL; /* nothing found yet */
for (i=0;cmdtab[i].cmdnr!=CMD_NULL;i++){
if (cmdtab[i].cmdstr!=NULL){
if (strcmp(cmdtab[i].cmdstr,cmdtok[1])==0){
/* found command string */
cmdnr=cmdtab[i].cmdnr;
break; /* done */
}
}
}
if (cmdnr==CMD_NULL){
printf("unknown command, try \"help\"\n\n");
goto main_parser_next;
}
printf("\nusage: ");
flag=0;
for (i=0;cmdtab[i].cmdnr!=CMD_NULL;i++){
if (cmdtab[i].cmdnr==cmdnr){
if (flag==0){
/* first */
if (cmdtab[i].cmdstr!=NULL){
if (cmdtab[i].cmduse!=NULL){
printf("%s %s\n",cmdtab[i].cmdstr,cmdtab[i].cmduse);
}else{
printf("%s\n",cmdtab[i].cmdstr);
}
}
if (cmdtab[i].cmdhelp!=NULL){
printf("\n%s\n",cmdtab[i].cmdhelp);
}
flag=1;
}else{
/* found alias */
if (flag==1){
printf("\naliases:\n");
flag=2;
}
if (cmdtab[i].cmdstr!=NULL){
printf(" %s\n",cmdtab[i].cmdstr);
}
}
}
}
printf("\n");
}
break;
case CMD_DF:
{
u_int di;
printf("\n");
akai_list_alldisks(0,NULL);
for (di=0;di<disk_num;di++){
akai_list_disk(&disk[di],0,NULL);
}
}
break;
case CMD_DINFO:
printf("\n");
curdir_info(1); /* 1: verbose */
break;
case CMD_CD:
if (cmdtoknr>1){
if (change_curdir(cmdtok[1],0,NULL,1)<0){ /* NULL,1: check last */
fprintf(stderr,"directory not found\n");
}
}else{
change_curdir_home(); /* ignore error */
}
break;
case CMD_CDI:
{
u_int vi;
if (check_curnosamplerpart()){ /* not on sampler partition level? */
fprintf(stderr,"must be on sampler partition level\n");
goto main_parser_next;
}
/* index */
vi=(u_int)atoi(cmdtok[1]);
if ((vi<1)||(vi>curpartp->volnummax)){
fprintf(stderr,"invalid volume index\n");
goto main_parser_next;
}
if (change_curdir(NULL,vi-1,NULL,1)<0){ /* NULL,1: check last */
fprintf(stderr,"directory not found\n");
}
}
break;
case CMD_DIR:
save_curdir(0); /* 0: no modifications */
if (cmdtoknr>1){
if (change_curdir(cmdtok[1],0,NULL,1)<0){ /* NULL,1: check last */
fprintf(stderr,"directory not found\n");
restore_curdir();
goto main_parser_next;
}
}
printf("\n");
list_curdir(0); /* 0: non-recursive */
restore_curdir();
break;
case CMD_DIRREC:
printf("\n");
list_curdir(1); /* 1: recursive */
break;
case CMD_LSTAGS:
if (curpartp!=NULL){ /* inside a parition or volume? */
printf("\n");
akai_list_tags(curpartp);
}
printf("\n");
list_curfiltertags();
printf("\n");
break;
case CMD_INITTAGS:
{
u_int i;
if ((curdiskp!=NULL)&&(curpartp==NULL)){ /* on disk level? */
/* all S1000/S3000 harddisk sampler partitions on current disk */
for (i=0;i<part_num;i++){
/* check if same disk and correct partition type */
if ((part[i].diskp!=curdiskp)||(part[i].type!=PART_TYPE_HD)){
continue; /* next */
}
/* now, S1000/S3000 harddisk sampler partition */
printf("partition %c:\n",part[i].letter);
akai_rename_tag(&part[i],NULL,0,1); /* 1: wipe, XXX ignore error */
}
}else{
if (check_curnosamplerpart()){ /* not on sampler partition level? */
fprintf(stderr,"must be on disk level or sampler partition level\n");
goto main_parser_next;
}
akai_rename_tag(curpartp,NULL,0,1); /* 1: wipe */
}
break;
}
case CMD_RENTAG:
{
u_int ti;
if (check_curnosamplerpart()){ /* not on sampler partition level? */
fprintf(stderr,"must be on sampler partition level\n");
goto main_parser_next;
}
/* index */
ti=(u_int)atoi(cmdtok[1]);
if ((ti<1)||(ti>AKAI_PARTHEAD_TAGNUM)){
fprintf(stderr,"invalid volume index\n");
goto main_parser_next;
}
akai_rename_tag(curpartp,cmdtok[2],ti-1,0); /* 0: don't wipe */
}
break;
case CMD_CDINFO:
case CMD_VCDINFO:
if (check_curnosamplerpart()){ /* not on sampler partition level? */
fprintf(stderr,"must be on sampler partition level\n");
goto main_parser_next;
}
printf("\n");
akai_print_cdinfo(curpartp,(cmdnr==CMD_VCDINFO)?1:0);
printf("\n");
break;
case CMD_SETCDINFO:
{
u_int i;
if ((curdiskp!=NULL)&&(curpartp==NULL)){ /* on disk level? */
/* all harddisk sampler partitions on current disk */
for (i=0;i<part_num;i++){
/* check if same disk and correct partition type */
if ((part[i].diskp!=curdiskp)||(part[i].type!=PART_TYPE_HD)){
continue; /* next */
}
/* now, S1000/S3000 harddisk sampler partition */
printf("partition %c:\n",part[i].letter);
akai_set_cdinfo(&part[i],(cmdtoknr>=2)?cmdtok[1]:NULL); /* XXX ignore error */
}
}else{
if (check_curnosamplerpart()){ /* not on sampler partition level? */
fprintf(stderr,"must be on disk level or on sampler partition level\n");
goto main_parser_next;
}
akai_set_cdinfo(curpartp,(cmdtoknr>=2)?cmdtok[1]:NULL);
}
break;
}
case CMD_LCD:
if (LCHDIR(cmdtok[1])<0){
fprintf(stderr,"invalid directory path\n");
}
break;
case CMD_LDIR:
LDIR;
break;
case CMD_LSFATI:
{
struct file_s tmpfile;
u_int fi;
if (check_curnosamplervol()){ /* not inside a sampler volume? */
fprintf(stderr,"must be inside a volume\n");
goto main_parser_next;
}
/* index */
fi=(u_int)atoi(cmdtok[1]);
if ((fi<1)||(fi>curvolp->fimax)){
fprintf(stderr,"invalid file index\n");
goto main_parser_next;
}
/* find file in current volume */
if (akai_get_file(curvolp,&tmpfile,fi-1)<0){
fprintf(stderr,"file not found\n");
goto main_parser_next;
}
printf("\n");
print_fatchain(curpartp,tmpfile.bstart);
printf("\n");
}
break;
case CMD_LSTFATI:
{
u_int ti;
u_int cstarts,cstarte;
if (check_curnoddpart()){ /* not on DD partition level? */
fprintf(stderr,"must be inside a DD partition\n");
goto main_parser_next;
}
/* index */
ti=(u_int)atoi(cmdtok[1]);
if ((ti<1)||(ti>AKAI_DDTAKE_MAXNUM)){
fprintf(stderr,"invalid take index\n");
goto main_parser_next;
}
/* find take in current partition */
cstarts=(curpartp->head.dd.take[ti-1].cstarts[1]<<8)
+curpartp->head.dd.take[ti-1].cstarts[0];
if (cstarts==0){ /* empty? */
fprintf(stderr,"take not found\n");
goto main_parser_next;