home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Vectronix 2
/
VECTRONIX2.iso
/
FILES_01
/
LATTIC_3.LZH
/
EXAMPLES
/
CHDIRACC.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-01-29
|
1KB
|
75 lines
/*
* chdiracc.c - a sample desk accessory for Lattice C 5
*
* Started 17/1/90 Alex G. Kiernan
*
* Compile using:
*
* lc -v -csfm -O -ta -Lavg chdiracc
*
* Copyright (c) 1990 HiSoft.
*/
#include <stdio.h>
#include <string.h>
#include <aes.h>
#include <dos.h>
int main(void)
{
char select[FNSIZE];
char dirname[FMSIZE];
short msg[8];
int id;
short button;
id=appl_init();
#ifndef NOT_A_DA
menu_register(id," Change Directory "); /* register as a DA */
#endif
/*
* now wait for it to be selected from desk accessories
* each select is once around loop
*/
for (;;)
{
#ifndef NOT_A_DA
evnt_mesag(msg); /* wait for an event */
if (msg[0]==AC_OPEN)
{
#endif
getcd(0,dirname);
strcat(dirname,"\\");
*select=0;
wind_update(BEG_MCTRL); /* prevent button fall through */
/* call fsel_exinput, always safe in Lattice 5 */
fsel_exinput(dirname,select,&button,"Change Directory");
wind_update(END_MCTRL); /* give back the mouse */
if (button)
{
char *s;
s=strrchr(dirname,'\\');
if (s)
s[1]='\0';
chdir(dirname);
}
#ifdef NOT_A_DA
else
break;
#else
}
#endif
}
#ifdef NOT_A_DA
appl_exit();
return 0;
#endif
}