a1200   NEWS   APPS   DOCS   ABOUT
a1200
----
a1200
----
Autodocs
 Static lib:
 amiga.lib
  ACrypt
  AddTOF
  ArgArrayDone
  ArgArrayInit
  ArgInt
  ArgString
  BeginIO
  CallHook
  CallHookA
  CheckRexxMsg
  CoerceMethod
  CoerceMethodA
  CreateExtIO
  CreatePort
  CreateStdIO
  CreateTask
  CxCustom
  CxDebug
  CxFilter
  CxSender
  CxSignal
  CxTranslate
  DeleteExtIO
  DeletePort
  DeleteStdIO
  DeleteTask
  DoMethod
  DoMethodA
  DoSuperMethod
  DoSuperMethodA
  FastRand
  FreeIEvents
  GetRexxVar
  HookEntry
  HotKey
  InvertString
  LibAllocPooled
  LibCreatePool
  LibDeletePool
  LibFreePooled
  NewList
  RangeRand
  RemTOF
  SetRexxVar
  SetSuperAttrs
  TimeDelay
  afp
  arnd
  dbf
  fpa
  printf
  sprintf
  stdio
Include
GuruMeditation
Docs » Autodocs » amiga.lib » ArgArrayInit

NAME

	ArgArrayInit -- allocate and initialize a tooltype array. (V36)

SYNOPSIS

	ttypes = ArgArrayInit(argc,argv);
UBYTE **ArgArrayInit(LONG,UBYTE **);

FUNCTION

	This function returns a null-terminated array of strings
suitable for sending to icon.library/FindToolType(). This array will
be the ToolTypes array of the program's icon, if it was started from
Workbench. It will just be 'argv' if the program was started from
a shell.
Pass ArgArrayInit() your startup arguments received by main().
ArgArrayInit() requires that icon.library be open (even if the caller
was started from a shell, so that the function FindToolType() can be
used) and may call GetDiskObject(), so clean up is necessary when
the strings are no longer needed. The function ArgArrayDone() does
just that.

INPUTS

	argc - the number of arguments in argv, 0 when started from Workbench
argv - an array of pointers to the program's arguments, or the
Workbench startup message when started from WB.

RESULT

	ttypes - the initialized argument array or NULL if it could not be
allocated

EXAMPLE

	Use of these routines facilitates the use of ToolTypes or command-
line arguments to control end-user parameters in Commodities
applications. For example, a filter used to trap a keystroke for
popping up a window might be created by something like this:
char *ttypes = ArgArrayInit(argc, argv);
CxObj *filter = UserFilter(ttypes, "POPWINDOW", "alt f1");
... with ...
CxObj *UserFilter(char **tt, char *action_name,
char *default_descr)
{
char *desc;
desc = FindToolType(tt,action_name);
return(CxFilter((ULONG)(desc? desc: default_descr)));
}
In this way the user can assign "alt f2" to the action by
entering a tooltype in the program's icon of the form:
POPWINDOW=alt f2
or by starting the program from the CLI like so:
myprogram "POPWINDOW=alt f2"

NOTES

	Your program must open icon.library and set up IconBase before calling
this routine. In addition IconBase must remain valid until after
ArgArrayDone() has been called!

SEE ALSO

ArgArrayDone(), ArgString(), ArgInt(), icon.library/FindToolType()

Comments

Name:
E-mail: Use this if you want a message if you get a response, will not be shown.
Comment:
Select correct short for:

Crystal

TRSI
PDX
SPB
CSL

Comments:

$VER: d0.se 1.14 Copyright © 2011-2024 Tobias Geijersson support at d0 dot se