home *** CD-ROM | disk | FTP | other *** search
-
- /*******************************************************************
- $CRT 29 Oct 1996 : hb
-
- $AUT Holger Burkarth
- $DAT >>FileReq.c<< 29 Jan 1997 13:31:40 - (C) ProDAD
- *******************************************************************/
-
- //##ex mcpp:cppc -gs -o pos:pos/Ex/FileReq p:pLib/StartCode.o p:/pOS_RKRM/pSL/FileReq.c p:pLib/StdIO.o -l pOSStub -l pOS
-
- /***********************************************************
- pOS programing example - Copyright (C) 1995-97 proDAD
-
- This code was written as an easy to understand example,
- how to program pOS features. It is provided 'as-is',
- without any express or implied warranty.
-
- Permission is hereby granted to use, copy and modify
- this source code for any purpose, without fee, subject
- to the following conditions:
-
- (1) This notice may not be removed or altered from any
- source distribution.
-
- (2) Altered source versions must be plainly marked as
- such, and must not be misrepresented as being
- the original source code.
-
- (3) If only executable code is distributed, then the
- accompanying documentation have to state that
- "this software is based in part on examples of
- the pOS developer packet".
-
- (4) Permission for use of this code is granted only
- if the user accepts full responsibility for any
- undesirable consequences. proDAD accept NO LIABILITY
- for damages of any kind.
-
- ©proDAD
- ***********************************************************/
-
- /*\
- *** Example:
- ***
- \*/
-
-
- #define __COMPUTER_AMIGA 1
- #define NOMYDEBUG
-
- #include "p:pExec/Types.h"
- #include "p:pDOS/ArgTags.h"
- #include "p:pDOS/DosSig.h"
- #include "p:pDOS/DosErrors.h"
- #include "p:psl/FileReq.h"
- #include "p:psl/pSLTags.h"
- #include "p:pDtType/DosObj.h"
- #include "p:proto/pExec2.h"
- #include "p:proto/pDOS2.h"
- #include "p:proto/pPSL2.h"
-
-
- #ifdef _____ME_____
- #include "grund/inc_string.h"
- #include "grund/inc_stdio.h"
- #else
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <string.h>
- #include <stdio.h>
- #ifdef __cplusplus
- }
- #endif
- #endif
-
-
- const CHAR *HelpText=
- ""
- ;
-
- const CHAR *PrgHeader=
- "";
-
- const CHAR *PrgVerText=
- "$VER: 1.0 ("__DATE2__") (Copyright 1996-97 by proDAD) (Created by Holger Burkarth)";
-
-
- struct pOS_pSLBase *gb_PSLBase;
-
-
- /*----------------------------------
- -----------------------------------*/
- extern "C" VOID main()
- {
- struct pOS_DosArgs* Args;
- UWORD Err=0;
- ULONG Ops[19]={0,0,0,0,0,1,1,1,1,1, 0,0,0,-1,-1,0,0,0,1};
-
- gb_PSLBase=(struct pOS_pSLBase*)pOS_OpenLibrary("psl.library",0);
-
- if(gb_PSLBase) {
- Args=pOS_ReadDosArgs(
- // 0 1 2 3 4 5 6
- "PATH/K, FILE/K, TITLE/K, PATTERN/K, PATGAD/S, NOINFOS/S, DOUBLEKLICK/S "
- // 7 8 9 10 11 12 13
- "DIRS/S, FILES/S, MATCHFILES/S, MATCHDIRS/S, POSTEXT/K, NEGTEXT/K, LEFT/N/K "
- // 14 15 16 17 18
- "TOP/N/K, ONLYDIRS/S, MULTISELECT/S, SAVEMODE/S, OWCHECK/S",
- Ops,sizeof(Ops)/sizeof(ULONG),
-
- ARGTAG_PrgHeaderText, (ULONG)PrgHeader, /* kurze Programm-Beschreibung */
- ARGTAG_HelpText, (ULONG)HelpText, /* Help-Texte */
- ARGTAG_PrgVerText, (ULONG)PrgVerText, /* VER-String */
- TAG_END);
-
- if(Args) {
- struct pOS_PslFileRequester *Req;
-
- Req=pOS_AllocFileRequest(
- TAG_END);
-
- if(Req) {
- SLONG Res;
-
- Res=pOS_PslFileRequest(Req,
- PSLFRTAG_PathPart, (ULONG)Ops[0],
- PSLFRTAG_FilePart, (ULONG)Ops[1],
- PSLFRTAG_Title, (ULONG)Ops[2],
- PSLFRTAG_Pattern, (ULONG)Ops[3],
- PSLFRTAG_PatternGad, (ULONG)Ops[4],
- PSLFRTAG_FilterInfos, (ULONG)Ops[5],
- PSLFRTAG_DoubleKlick, (ULONG)Ops[6],
- PSLFRTAG_ShowDirs, (ULONG)Ops[7],
- PSLFRTAG_ShowFiles, (ULONG)Ops[8],
- PSLFRTAG_MatchFiles, (ULONG)Ops[9],
- PSLFRTAG_MatchDirs, (ULONG)Ops[10],
- PSLFRTAG_PositiveText,(ULONG)Ops[11],
- PSLFRTAG_NegativeText,(ULONG)Ops[12],
- PSLFRTAG_LeftEdge, *((ULONG*)Ops[13]),
- PSLFRTAG_TopEdge, *((ULONG*)Ops[14]),
- PSLFRTAG_OnlyDirs, (ULONG)Ops[15],
- PSLFRTAG_MultiSelect, (ULONG)Ops[16],
- PSLFRTAG_SaveMode, (ULONG)Ops[17],
- PSLFRTAG_OWCheck, (ULONG)Ops[18],
- TAG_END);
-
- if(Req->pfr_DDNum>0) {
- if(Ops[16] !=0 ) { // Multi
- UWORD i;
- dosname_t Buffer[pOS_DosPathName_MAX];
- for(i=0; i<Req->pfr_DDNum; ++i) {
- pOS_NameFromObjectLock(Req->pfr_DDList[i].dtdos_Lock,Buffer,sizeof(Buffer));
- pOS_AddPart(Buffer,Req->pfr_DDList[i].dtdos_Buffer,sizeof(Buffer));
- printf("\"%s\" ",Buffer);
- }
- printf("\n");
- }
- else printf("%s%s\n",Req->pfr_Path,Req->pfr_File);
- }
- else Err=DOSFAIL_WARN;
-
- pOS_FreePslRequest(Req);
- }
- else printf("pOS_AllocFileRequest() - failed\n");
- pOS_DeleteDosArgs(Args); /* Args freigeben */
- }
- else Err=DOSFAIL_FAIL; /* vollkommen fehlgeschlagen */
- }
- else {
- Err=DOSFAIL_FAIL; /* vollkommen fehlgeschlagen */
- printf("Cannot open psl.library\n");
- }
- pOS_SetShellFail(Err);
- if(gb_PSLBase) pOS_CloseLibrary((struct pOS_Library*)gb_PSLBase);
- }
-