示例#1
0
mlx_extract()
{
	char filename[13],pathname[80];
	char *ext;
	int nblocks,block;
	register int i;
	long blockptr[MAXNBLOCKS+1];
	long addr[32],leng[32];	/* oversized */
	long end_record= idEND;
	GLOBRECORD *ptr;

	/* load multi-block file containing block to be extracted */
	Dsetdrv(mlt_drive); dsetpath(mlt_path);
	if (!readdatafile(MLXEXTTITL,mlxfile,mlxpath,MLX_EXT,0)) return;
	mlt_drive= Dgetdrv(); Dgetpath(mlt_path,mlt_drive+1);
	mlx_mem= tempmem;

	/* choose block from it */
	nblocks= scan_blocks(heap[mlx_mem].start,blockptr);
	if (!nblocks) return;	/* can't happen? */
	block= select_block(BLOCK2EXT,nblocks,blockptr);
	if ( (block<0) || (block>=nblocks) ) return;

	/* name of data file defaults to block comment */
	Dsetdrv(data_drive); dsetpath(data_path);
	ptr= (GLOBRECORD*)(blockptr[block]);
	copy_bytes(ptr->comment,filename,12L);
	filename[12]=0;
	ext=filename;
	for (i=0; i<9; i++) if (ext[i]=='.') break;
	if (i<9)
		ext+=(i+1);
	else
		ext= ALL_EXT;
	if (getfile(pathname,filename,ext,MLXXDATTITL)<=0) return;
	data_drive= Dgetdrv(); Dgetpath(data_path,data_drive+1);

	/* build file -- */
	i=0;

	/* -- header */
	addr[i]= (long)(&dataheader);
	leng[i++]= sizeof(dataheader);

	/* -- the selected block */
	addr[i]= blockptr[block];
	leng[i++]= blockptr[block+1] - blockptr[block] ;

	/* -- end record */
	addr[i]= (long)(&end_record);
	leng[i++]= 4;

	save_file(filename,pathname,i,addr,leng);

}	/* end mlx_extract() */
示例#2
0
char *x_getpath(int drive, int *error)
{
	char *buffer, *h;

	if ((buffer = malloc(sizeof(LNAME))) == NULL)			/* HR 240203 */
	{
		*error = ENSMEM;
		return NULL;
	}

	buffer[0] = (char) (((drive == 0) ? x_getdrv(): (drive - 1)) + 'A');
	buffer[1] = ':';

#if USE_gemdos
	if ((*error = xerror((int) gemdos(71, buffer + 2, drive))) < 0)
#else
	if ((*error = xerror(Dgetpath(buffer + 2, drive))) < 0)
#endif
	{
		free(buffer);
		return NULL;
	}

	h = realloc(buffer, strlen(buffer) + 1);

	return (h == NULL) ? buffer : h;
}
示例#3
0
/* ---------------- */
main()
{
    char path2[80];
    long code_len;

    appl_init();

    path1[0] = Dgetdrv();
    path1[1] = ':';
    Dgetpath(path1 + 2, path1[0] + 1);
    path1[0] += 'A';
    strcat(path1, "\\*.PRT");

    code_len = (long)Malloc(-1L) - 75000;
    code_mem = (unsigned char *)Malloc(code_len);

    graf_mouse(ARROW, 0L);

    do
    {
        if (!fsel(path1, "PRT", "Druckersource w�hlen!"))
            break;

        strcpy(path2, path1);
        if (rindex(path2, '.') > rindex(path2, '\\'))
            strcpy(rindex(path2, '.'), ".PRC");

        if (fsel(path2, "PRC", "Treiberdatei w�hlen!"))
            comp_source(path1, path2);

    } while(TRUE);

    appl_exit();
}
示例#4
0
mlx_name()
{
	int nblocks,block;
	GLOBRECORD *blockptr[MAXNBLOCKS+1];
	long addr[32],leng[32];	/* oversized */

	/* load multi-block file containing block to be renamed */
	Dsetdrv(mlt_drive); dsetpath(mlt_path);
	if (!readdatafile(MLXNAMTITL,mlxfile,mlxpath,MLX_EXT,0)) return;
	mlt_drive= Dgetdrv(); Dgetpath(mlt_path,mlt_drive+1);
	mlx_mem= tempmem;

	/* choose block from it */
	nblocks= scan_blocks(heap[mlx_mem].start,blockptr);
	if (!nblocks) return;	/* can't happen? */
	block= select_block(BLOCK2NAM,nblocks,blockptr);
	if ( (block<0) || (block>=nblocks) ) return;

	/* edit the comment field in the selected block, and replace file
		without warning */
	if (_mlx_name(blockptr[block]->comment))
	{
		addr[0]= heap[mlx_mem].start;
		leng[0]= heap[mlx_mem].nbytes;
		save_file(mlxfile,mlxpath,-1,addr,leng);
	}

}	/* end mlx_name() */
示例#5
0
void sauve_palette(void)
{
  int  pal[256*3] ;
  char name[200] ;
  char *pt ;

  if (*path_palette == 0)
  {
    Dgetpath( path_palette+2, 0 ) ;
    path_palette[1] = ':' ;
    path_palette[0] = 'A'+Dgetdrv() ;
    strcat(path_palette, "\\*.PAL") ;
  }

  if (file_name(path_palette, "", name))
  {
    FILE *stream ;

    stream = fopen(name, "wb") ;
    if (stream == NULL)
    {
      form_stop(1, msg[MSG_WRITEERROR]) ;
      return ;
    }
    get_vdipalette(pal) ;
    if (fwrite(pal, 6, nb_colors, stream) != nb_colors)
      form_stop(1, msg[MSG_WRITEERROR]) ;
    fclose(stream) ;
    strcpy(path_palette, name) ;
    pt = strrchr(path_palette, '\\') ;
    if (pt != NULL) *(1+pt) = 0 ;
    else            *path_palette = 0 ;
  }
}
示例#6
0
/*******************************************************************************
	Test if a folder exists
*******************************************************************************/
int _dexist(char *name)
{
	char	old_path[FILENAME_MAX];
	char	myname[FILENAME_MAX];
	int	old_drv;
	int	i,ok=FALSE;
	DTA	*old,dta;

	old=Fgetdta();
	old_drv=Dgetdrv();
	Dgetpath(old_path,1+old_drv);
	if (name[1]==':')
		Dsetdrv((int)name[1]-65);
	Fsetdta(&dta);

	strcpy(myname,name);
	i=(int)strlen(myname);
	if (myname[i-1]=='\\')
		strcat(myname,"*.*");
	else
		strcat(myname,"\\*.*");
	if (!Fsfirst(myname,FA_READONLY+FA_HIDDEN+FA_SYSTEM+FA_ARCHIVE+FA_SUBDIR))
		ok=TRUE;
	Dsetdrv(old_drv);
	Dsetpath(old_path);
	Fsetdta(old);
	return ok;
}
示例#7
0
ex_loadtem()
{
#if TEMFLAG
	char filename[13],pathname[80];
	long load_file();

	/* overwrite changed template? */
	if (change_flag[temCHANGE])
		if (form_alert(1,CHNGETEM)==2) return;

	filename[0]=0;
	Dsetdrv(tem_drive); dsetpath(tem_path);
	tempmem= -1;
	if (getfile(pathname,filename,TE_EXT,TLDETITL)>0)
	{
		tem_drive=Dgetdrv(); Dgetpath(tem_path,tem_drive+1);
		if (load_file(pathname,filename))
		{
			if (load_tem(filename))
			{
				strcpy(temfile,filename);
			}
		}	/* end if file loaded successfully */
	}	/* end if ok from file selector */

	dealloc_mem(tempmem);

#endif
}	/* end ex_loadtem() */
示例#8
0
get_path()
{
	syspath[0] = (char)Dgetdrv() + 'A';
	syspath[1] = ':';
	Dgetpath(&syspath[2],0);
	strcat(syspath,"\\");
	strcpy(pathbuf,syspath);
}
示例#9
0
/* --------------------------------- */
void init_mtext(void)
{
register int i, j;
int a, b;

scrtchp = (long)Malloc(2048L);

mtext_mlen = (long)Malloc(-1L) - 75000;
mtext_mem = (unsigned char *)Malloc(mtext_mlen);

/*printf("\033H%lx\n", mtext_mem);*/

memset(mtext_mem, 0, mtext_mlen);

pathes[0][0] = Dgetdrv();
pathes[0][1] = ':';
Dgetpath(pathes[0] + 2, 0);
strcat(pathes[0] + 2, "\\");
pathes[0][0] += 'A';

strcpy(pathes[1], pathes[0]);
strcpy(pathes[2], pathes[0]);
strcpy(pathes[3], pathes[0]);

pic_fpath[0] = pathes[0][0];
del_file[0] = font_path[0] = pathes[0][0];

for (i = 0; i < 68; txt_lineal[0][i++] = '.');
txt_lineal[0][68] = 0;

strcpy(txt_lineal[1], txt_lineal[0]);
strcpy(txt_lineal[2], txt_lineal[0]);
strcpy(txt_lineal[3], txt_lineal[0]);

strncpy(txt_linpar[0], "NPS110", 6);
strncpy(txt_linpar[1], txt_linpar[0], 6);
strncpy(txt_linpar[2], txt_linpar[0], 6);
strncpy(txt_linpar[3], txt_linpar[0], 6);

strcpy(txt_infol[0], "  Seite: 999, Zeile: 99999, Spalte: 999          Einf�gen ");
strcpy(txt_infol[1], txt_infol[0]);
strcpy(txt_infol[2], txt_infol[0]);
strcpy(txt_infol[3], txt_infol[0]);

vst_alignment(vdi_handle, 0, 3, &a, &b);
vsf_perimeter(vdi_handle, FALSE);

load_cfg();

get_work(0);
for (i = 0; i < 4; i++)
	{
	w_koor[i][0] = wx;
	w_koor[i][1] = wy;
	w_koor[i][2] = ww - (3 - i) * 10;
	w_koor[i][3] = wh - i * 10;
	}
}
示例#10
0
init_fname()
{
current_drive = Dgetdrv();
Dgetpath(current_dir, 0);
fold_buf[0] = current_drive + 'A';
fold_buf[1] = ':';
strcat(fold_buf, current_dir);
strcat(fold_buf, "\\");
}
示例#11
0
mlx_delete()
{
	int nblocks,block;
	register int i;
	long blockptr[MAXNBLOCKS+1];
	long addr[32],leng[32];	/* oversized */
	long end_record= idEND;

	/* load multi-block file containing block to be deleted */
	Dsetdrv(mlt_drive); dsetpath(mlt_path);
	if (!readdatafile(MLXDELTITL,mlxfile,mlxpath,MLX_EXT,0)) return;
	mlt_drive= Dgetdrv(); Dgetpath(mlt_path,mlt_drive+1);
	mlx_mem= tempmem;

	/* choose block from it */
	nblocks= scan_blocks(heap[mlx_mem].start,blockptr);
	if (!nblocks) return;	/* can't happen? */
	if (nblocks==1)
	{
		form_alert(1,BADMLXDEL);
		return;
	}
	block= select_block(BLOCK2DEL,nblocks,blockptr);
	if ( (block<0) || (block>=nblocks) ) return;

	/* build file -- */
	i=0;

	/* -- header */
	addr[i]= (long)(&dataheader);
	leng[i++]= sizeof(dataheader);

	/* -- blocks before the selected block */
	if (block>0)
	{
		addr[i]= blockptr[0];
		leng[i++]= blockptr[block] - blockptr[0] ;
	}

	/* -- blocks after the selected block */
	if (block<(nblocks-1))
	{
		addr[i]= blockptr[block+1];
		leng[i++]= blockptr[nblocks] - blockptr[block+1] ;
	}

	/* -- end record */
	addr[i]= (long)(&end_record);
	leng[i++]= 4;

	save_file(mlxfile,mlxpath,-i,addr,leng);	/* replace without warning */

}	/* end mlx_delete() */
示例#12
0
// Determine which directory contains the executable.
// IN: Main's argv[0], some platforms need it, some don't.
// OUT: Write into program_dir. Trailing / or \ is kept.
// Note : in fact this is only used to check for the datafiles and fonts in 
// this same directory.
void Set_program_directory(const char * argv0,char * program_dir)
{
  (void)argv0; // unused sometimes
  
  // MacOSX
  #if defined(__macosx__)
    CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
    CFURLGetFileSystemRepresentation(url,true,(UInt8*)program_dir,MAXPATHLEN);
    CFRelease(url);
    // Append trailing slash
    strcat(program_dir    ,"/");
  
  // AmigaOS and alike: hard-coded volume name.
  #elif defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) || defined(__amigaos__)
    strcpy(program_dir,"PROGDIR:");
  #elif defined(__MINT__)
  static char path[1024]={0};
  char currentDrive='A';
  currentDrive=currentDrive+Dgetdrv();
  
  Dgetpath(path,0);
  sprintf(program_dir,"%c:\%s",currentDrive,path);
  // Append trailing slash
  strcat(program_dir,PATH_SEPARATOR);
  // Linux: argv[0] unreliable
  #elif defined(__ANDROID__)
  getcwd(program_dir, MAX_PATH_CHARACTERS);
  strcat(program_dir, "/");
  #elif defined(__linux__)
  if (argv0[0]!='/')
  {
    char path[PATH_MAX];
    readlink("/proc/self/exe", path, sizeof(path));
    Extract_path(program_dir, path);
    return;
  }  
  Extract_path(program_dir, argv0);
  
  // Others: The part of argv[0] before the executable name.    
  // Keep the last \ or /.
  // On Windows, Mingw32 already provides the full path in all cases.
  #else
    Extract_path(program_dir, argv0);
  #endif
  printf("Set_program_directory: %s\n", program_dir);
}
示例#13
0
int load_reg_file(void)
{
  char filename[MAXSTRING],filepath[MAXSTRING];
  FILE *file;
  short dummy;

  strcpy(filepath,"A:");
  filepath[0]=Dgetdrv()+'A';
  Dgetpath(filepath+2,0);
  strcat(filepath,"\\*.DAT");
  strcpy(filename,"REGISTER.DAT");
  fsel_exinput(filepath, filename, &dummy,alerts[A_LOAD_KEY]);
  if(!dummy)
    return(FALSE);

  strcpy(strrchr(filepath,'\\')+1,filename);

  file=fopen(filepath,"rb");
  if(file==NULL)
  {
    alertbox(1,alerts[ER_FILE_OPEN]);
    return(FALSE);
  }

  dummy=FALSE;
  fgets(filename,MAXSTRING,file);
  while((filename[strlen(filename)-1]=='\n')||(filename[strlen(filename)-1]=='\r')) filename[strlen(filename)-1]=NOLL;
  str2ted(register_win.dialog,REG_NAME,filename);
  fgets(filename,MAXSTRING,file);
  while((filename[strlen(filename)-1]=='\n')||(filename[strlen(filename)-1]=='\r')) filename[strlen(filename)-1]=NOLL;
  str2ted(register_win.dialog,REG_ADR1,filename);
  fgets(filename,MAXSTRING,file);
  while((filename[strlen(filename)-1]=='\n')||(filename[strlen(filename)-1]=='\r')) filename[strlen(filename)-1]=NOLL;
  str2ted(register_win.dialog,REG_ADR2,filename);
  fgets(filename,MAXSTRING,file);
  while((filename[strlen(filename)-1]=='\n')||(filename[strlen(filename)-1]=='\r')) filename[strlen(filename)-1]=NOLL;
  str2ted(register_win.dialog,REG_ADR3,filename);
  fgets(filename,MAXSTRING,file);
  while((filename[strlen(filename)-1]=='\n')||(filename[strlen(filename)-1]=='\r')) filename[strlen(filename)-1]=NOLL;
  str2ted(register_win.dialog,REG_KEY,filename);

  fclose(file);
  return(TRUE);
}
示例#14
0
static int _fullname(char *buffer)
{
	char *name, *h, *d, *s;
	int error;

	if ((name = strdup(buffer)) == NULL)
		error = ENSMEM;
	else
	{
		d = buffer;

		if ((h = strchr(name, ':')) == NULL)
		{
			*d++ = (char) (x_getdrv() + 'A');
			*d++ = ':';
			h = name;
		}
		else
		{
			h++;
			s = name;
			while (s != h)
				*d++ = *s++;
		}

		if (*h == '\\')
		{
			strcpy(d, h);
			error = 0;
		}
		else
		{
#if USE_gemdos
			if ((error = xerror((int) gemdos(71, d, (int) (buffer[0] - 'A' + 1)))) == 0)
#else
			if ((error = xerror(Dgetpath(d, buffer[0] - 'A' + 1))) == 0)
#endif
				make_path(buffer, buffer, h);
		}
		free(name);
	}
	return error;
}
示例#15
0
VOID get_path(BYTE *tmp_path, BYTE *spec)
{
	WORD	cur_drv;

#if GEMDOS
	cur_drv = Dgetdrv();
#else
	cur_drv = dos_gdrv();
#endif
	tmp_path[0] = cur_drv + 'A';
	tmp_path[1] = ':';
	tmp_path[2] = '\\';
#if GEMDOS
	Dgetpath((char *)ADDR(&tmp_path[3]), cur_drv+1);
#else
	dos_gdir(cur_drv+1, ADDR(&tmp_path[3]));
#endif
	if (strlen(tmp_path) > 3)
		strcat(tmp_path, "\\");
	else
		tmp_path[2] = '\0';
	strcat(tmp_path, spec);
}
示例#16
0
/*******************************************************************************
	Test if a file exists
*******************************************************************************/
int _fexist(char *name,DTA *res)
{
	char	old_path[FILENAME_MAX];
	int	old_drv;
	int	ok=FALSE;
	DTA	*old,dta;

	old=Fgetdta();
	old_drv=Dgetdrv();
	Dgetpath(old_path,1+old_drv);
	if (name[1]==':')
		Dsetdrv((int)name[1]-65);
	Fsetdta(&dta);

	if (!Fsfirst(name,FA_READONLY+FA_HIDDEN+FA_SYSTEM+FA_ARCHIVE+FA_SUBDIR))
		ok=TRUE;
	if (ok && res)
		memcpy((void *)res,(void *)&dta,sizeof(DTA));
	Dsetdrv(old_drv);
	Dsetpath(old_path);
	Fsetdta(old);
	return ok;
}
示例#17
0
void  get_path()

{
   int   handle;
   long  len;
   char  *ptr, file[] = "\\IND.INF", path[] = "\\ISM";

   inetd_path[0] = 'A' + Dgetdrv();
   inetd_path[1] = ':';
   Dgetpath (&inetd_path[2], 0);

   strcpy (ism_path, inetd_path);

   strcat (ism_path, file);
   handle = (int) Fopen (ism_path, 0);

   if (handle < 0) {
        strcpy (&ism_path[2], file);
        handle = (int) Fopen (ism_path, 0);

        if (handle < 0) {
             strcpy (ism_path, path);
             return;
           }
      }

   len = Fread (handle, 250L, ism_path);
   Fclose (handle);

   if (len > 0) {
        if ((ptr = strchr (ism_path, '\r')) != NULL)   *ptr = '\0';
        if ((ptr = strchr (ism_path, '\n')) != NULL)   *ptr = '\0';
        ism_path[len] = '\0';
      }
     else
        strcpy (&ism_path[2], path);
 }
示例#18
0
void charge_palette(void)
{
  int  pal[256*3] ;
  int  ncol ;
  char name[200] ;
  char *pt ;

  if (*path_palette == 0)
  {
    Dgetpath( path_palette+2, 0 ) ;
    path_palette[1] = ':' ;
    path_palette[0] = 'A'+Dgetdrv() ;
    strcat(path_palette, "\\*.PAL") ;
  }

  if (file_name(path_palette, "", name))
  {
    FILE *stream ;

    ncol   = (int) file_size(name)/6 ;
    stream = fopen(name, "rb") ;
    if ( ( ncol < 0 ) || ( stream == NULL ) )
    {
      form_stop(1, msg[MSG_FILENOTEXIST]) ;
      return ;
    }
    if (ncol > nb_colors) ncol = nb_colors ;
    fread(pal, 6, ncol, stream) ;
    fclose(stream) ;
    set_vdipalette(pal, ncol) ;
    strcpy(path_palette, name) ;
    pt = strrchr(path_palette, '\\') ;
    if (pt != NULL) *(1+pt) = 0 ;
    else            *path_palette = 0 ;
  }
}
示例#19
0
mlx_add()
{
	long blockptr[MAXNBLOCKS+1];
	char filename[13],pathname[80];
	int block,nblocks,create_it;
	register int i;
	long addr[32],leng[32];	/* oversized */
	long end_record= idEND;

	/* load data file containing block to be added */
	Dsetdrv(data_drive); dsetpath(data_path);
	filename[0]=0;
	if (!readdatafile(MLXDATTITL,filename,pathname,ALL_EXT,0)) return;
	data_drive= Dgetdrv(); Dgetpath(data_path,data_drive+1);
	data_mem= tempmem;

	/* choose block from it */
	nblocks= scan_blocks(heap[data_mem].start,blockptr);
	if (!nblocks) return;	/* can't happen? */
	block= select_block(BLOCK2ADD,nblocks,blockptr);
	if ( (block<0) || (block>=nblocks) ) return;

	/* load multi-block file to receive block */
	Dsetdrv(mlt_drive); dsetpath(mlt_path);
	create_it= readdatafile(MLXADDTITL,mlxfile,mlxpath,MLX_EXT,1);
	if (!create_it) return;
	if (create_it<0)
	{
		if (form_alert(1,CHEKCREMLX)!=1) return;
		create_it=1;
	}
	else
		create_it=0;
	mlt_drive= Dgetdrv(); Dgetpath(mlt_path,mlt_drive+1);
	mlx_mem= tempmem;

	/* because data_mem may have moved */
	scan_blocks(heap[data_mem].start,blockptr);

	/* build file -- */
	i=0;

	/* -- header */
	addr[i]= (long)(&dataheader);
	leng[i++]= sizeof(dataheader);

	/* -- if file already exists, chop header off start, end_record off end */
	if (!create_it)
	{
		addr[i]= heap[mlx_mem].start + sizeof(dataheader);
		leng[i++]= heap[mlx_mem].nbytes - 4 - sizeof(dataheader);
	}

	/* -- the new block */
	addr[i]= blockptr[block];
	leng[i++]= blockptr[block+1] - blockptr[block];

	/* -- end_record */
	addr[i]= (long)(&end_record);
	leng[i++]= 4;

	save_file(mlxfile,mlxpath,-i,addr,leng); /* replace without warning */

}	/* end mlx_add() */
示例#20
0
//********************************************************************
// 1998-09-16 - Created
//********************************************************************
// Initiates the Application so that it can make AES calls
//********************************************************************
int init_appl(void)
{
	char	args[ MAXSTRING ];
	char	progname[ SIZE_ID + 1 ];  
	int		flag;
	char	*temp_s;
	char	*addr;
	
	ap_id = appl_init();
	if( ap_id == FAIL )
	{
		sprintf( tempvar.errorstring , APPL_ERROR );
		alertbox( 1 , tempvar.errorstring );
		
		#ifdef LOGGING 
		Log( LOG_INIT , "Could register Application!!!!\n" ); 
		#endif

		Return FALSE;
	}

	Pdomain( 1 );

	flag = shel_read( system_dir , args);
	if( !flag )
	{
		#ifdef LOGGING
			Log( LOG_INIT , "shell_read, did not work :( %d\n" , flag );
		#endif
		Return FALSE;
	}

	#ifdef LOGGING
	Log(LOG_INIT,"system-path returned by shell_read: %s\n",system_dir);
	#endif

	temp_s = ( char * )strrchr( system_dir , '\\' );
	if( temp_s == NULL )
	{
		#ifdef LOGGING
		Log( LOG_INIT , "there was no end '\\' in the pathname: %s\n " , system_dir);
		#endif
		Return FALSE;
	}
	*temp_s++ = 0;
	strncpy( progname , temp_s , 8 );
	strcat( system_dir , "\\fireconf\\" );
	progname[ 8 ] = 0;
	temp_s = ( char * )strchr( progname , '.' );
	if( temp_s )
		*temp_s = 0;
	while ( strlen( progname ) < 8 )
		strcat( progname, " " );

	if( ( !strcmp( progname , "LC5     " ) ) || ( system_dir[ 0 ] == 0 ) )
	{
		#ifdef LOGGING
		Log( LOG_INIT , "could not use path provided from shell-read , resorting to a different method \n " );
		#endif
		strcpy( system_dir , "A:" );
		system_dir[ 0 ] = Dgetdrv() + 'A';
		Dgetpath( system_dir + 2 , 0 );
		strcat( system_dir , "\\fireconf\\" );
	}
  
	#ifdef LOGGING
	Log( LOG_INIT , "Getting the name of the AV-Server\n" );
	#endif

	flag = shel_envrn( &addr , "AVSERVER=" );
	if( !addr )
	{
		#ifdef LOGGING
		Log( LOG_INIT , "NO AVSERVER enviroment string found \n" );
		#endif
    	if( appl_find( "AVSERVER" ) >= 0 )
    	{
			#ifdef LOGGING
			Log( LOG_INIT , "AVSERVER Application found\n" );
			#endif

			strcpy( avserver , "AVSERVER" );
		}
		else if( appl_find( "THING   " ) >=0 )
		{
			#ifdef LOGGING
			Log( LOG_INIT , "THING Application found\n" );
			#endif

			strcpy(avserver,"THING   ");
		}
		else if( appl_find( "GEMINI  " ) >=0 )
		{
			#ifdef LOGGING
			Log( LOG_INIT , "GEMINI Application found\n" );
			#endif
			
			strcpy( avserver , "GEMINI  " );
		}

		if( avserver[ 0 ] == 0 )
		{
			#ifdef LOGGING
			Log( LOG_INIT , "No AVSERVER application found\n" );
			#endif
		}
	}
	else
	{
		#ifdef LOGGING
		Log( LOG_INIT , "AVSERVER: %s\n" , addr );
		#endif

		strcpy( avserver , addr );
		while ( strlen( avserver ) < 8 )
			strcat( avserver, " ");
	}  
	flag = appl_find( avserver );
	if ( flag == ap_id )
		strcpy( avserver , "" );

	Return TRUE;
}
示例#21
0
mlx_replace()
{
	char filename[13],pathname[80];
	int mlxnblocks,mlxblock;
	int datnblocks,datblock;
	long mlxblockptr[MAXNBLOCKS+1];
	long datblockptr[MAXNBLOCKS+1];
	register int i;
	long addr[32],leng[32];	/* oversized */
	long end_record= idEND;

	/* load data file containing block to be added */
	Dsetdrv(data_drive); dsetpath(data_path);
	filename[0]=0;
	if (!readdatafile(MLXRDATTITL,filename,pathname,ALL_EXT,0)) return;
	data_drive= Dgetdrv(); Dgetpath(data_path,data_drive+1);
	data_mem= tempmem;

	/* choose block from it */
	datnblocks= scan_blocks(heap[data_mem].start,datblockptr);
	if (!datnblocks) return;	/* can't happen? */
	datblock= select_block(BLOCK2REP,datnblocks,datblockptr);
	if ( (datblock<0) || (datblock>=datnblocks) ) return;

	/* load multi-block file to receive block */
	Dsetdrv(mlt_drive); dsetpath(mlt_path);
	if (!readdatafile(MLXREPTITL,mlxfile,mlxpath,MLX_EXT,0)) return;
	mlt_drive= Dgetdrv(); Dgetpath(mlt_path,mlt_drive+1);
	mlx_mem= tempmem;

	/* choose block from it */
	mlxnblocks= scan_blocks(heap[mlx_mem].start,mlxblockptr);
	if (!mlxnblocks) return;	/* can't happen? */
	mlxblock= select_block(BLOCK2BRP,mlxnblocks,mlxblockptr);
	if ( (mlxblock<0) || (mlxblock>=mlxnblocks) ) return;

	/* because data_mem may have moved */
	scan_blocks(heap[data_mem].start,datblockptr);

	/* build file -- */
	i=0;

	/* -- header */
	addr[i]= (long)(&dataheader);
	leng[i++]= sizeof(dataheader);

	/* -- blocks before the selected block */
	if (mlxblock>0)
	{
		addr[i]= mlxblockptr[0];
		leng[i++]= mlxblockptr[mlxblock] - mlxblockptr[0] ;
	}

	/* -- new block */
	addr[i]= datblockptr[datblock];
	leng[i++]= datblockptr[datblock+1] - datblockptr[datblock] ;

	/* -- blocks after the selected block */
	if (mlxblock<(mlxnblocks-1))
	{
		addr[i]= mlxblockptr[mlxblock+1];
		leng[i++]= mlxblockptr[mlxnblocks] - mlxblockptr[mlxblock+1] ;
	}

	/* -- end record */
	addr[i]= (long)(&end_record);
	leng[i++]= 4;

	save_file(mlxfile,mlxpath,-i,addr,leng);	/* replace without warning */

}	/* end mlx_replace() */
示例#22
0
文件: launcher.c 项目: e8johan/oaesis
/*
** Description
** Let the user select an application and start it
*/
static
void
launch_application (void)
{
  char   execpath[128]; /*FIXME length of string */
  char   oldpath[128];
  char * tmp;
  int    button;

  /* Open file selector */
  fsel_exinput(progpath, progfile, &button, "Select program to start");

  /* Handle request if OK was selected */
  if(button == FSEL_OK)
  {
    int  err;
    char newpath[128];
    
    strcpy(newpath,progpath);
    
    tmp = strrchr (newpath, PATH_SEPARATOR);
    
    if(tmp)
    {
      *tmp = 0;
      sprintf (execpath, "%s%c%s", newpath, PATH_SEPARATOR, progfile);
    }
    else
    {
      strcpy (execpath, progfile);
    }


#ifdef MINT_TARGET
    /* FIXME: Use shel_write instead */
    Dgetpath(oldpath, 0);
    misc_setpath(newpath);

    err = Pexec(100, execpath, 0L, 0L);

    misc_setpath(oldpath);
#else
    getcwd (oldpath, 128);
    chdir (newpath);

    if (fork () == 0)
    {
      execlp (execpath, NULL);

      exit (0);
    }

    chdir (oldpath);

    err = 0;
#endif

    if (err < 0) {
      form_error ((WORD) -err - 31);
    }
  }
}
示例#23
0
/*******************************************************************************
	BALAYAGE D'UN DOSSIER
*******************************************************************************/
static int Balaie_Path(char *directory,int wx,int wy,int ww,int wh)
{
	char		old_path[FILENAME_MAX];
	int		old_drv;
	char		pfn[FILENAME_MAX];
	DTA		*mydta;
	int		i,Fin=0;
	int		cnt,pos;
/*	long		count;*/

	t2=0;
	old_drv=Dgetdrv();
	Dgetpath(old_path,1+old_drv);
	mydta=Fgetdta();
	if (directory[1]==':')
		Dsetdrv((int)directory[1]-65);

	strcpy(pfn,directory);
	strcat(pfn,"\\*.*");
	if (glb.opt.sl_rec)
		i=Fsfirst(pfn,FA_READONLY|FA_SUBDIR|FA_ARCHIVE);
	else
		i=Fsfirst(pfn,FA_READONLY|FA_ARCHIVE);
	pos=0;
loop1:
	cnt=0;
	while (!i)
	{
		cnt+=1;
		if (mydta->d_fname[0]!='.' && cnt>pos)
		{
			strcpy(pfn,directory);
			strcat(pfn,"\\");
			strcat(pfn,mydta->d_fname);
			if (mydta->d_attrib&FA_SUBDIR)
			{
				pos=cnt;
				if (Balaie_Path(pfn,wx,wy,ww,wh))
					return TRUE;
				strcpy(pfn,directory);
				strcat(pfn,"\\*.*");
				if (glb.opt.sl_rec)
					i=Fsfirst(pfn,FA_READONLY|FA_SUBDIR|FA_ARCHIVE);
				else
					i=Fsfirst(pfn,FA_READONLY|FA_ARCHIVE);
				goto loop1;
			}
		}
		if (Kbshift(-1)!=shift)
			return TRUE;
		i=Fsnext();
/*
		if (i!=0)
			{
				time(&t1);
				if(glb.opt.sl_pause)
				{
					count=1000L*max( 0 , (long)glb.opt.sl_ptime - (t1-t2) );
					evnt_timer( (int)(count&0xFFFFUL),(int)(count>>16) );
				}
				else
					count=0;
			}
*/
	}


	strcpy(pfn,directory);
	strcat(pfn,"\\");
	strcat(pfn,glb.opt.sl_name);

	if (glb.opt.sl_rec)
		i=Fsfirst(pfn,FA_READONLY|FA_SUBDIR|FA_ARCHIVE);
	else
		i=Fsfirst(pfn,FA_READONLY|FA_ARCHIVE);
	pos=0;
	cnt=0;
	while (!i)
	{
		cnt+=1;
		if (mydta->d_fname[0]!='.' && cnt>pos)
		{
			strcpy(pfn,directory);
			strcat(pfn,"\\");
			strcat(pfn,mydta->d_fname);
			if (!(mydta->d_attrib&FA_SUBDIR))
				affiche(pfn,wx,wy,ww,wh);
		}
		if (Kbshift(-1)!=shift)
			return TRUE;
		i=Fsnext();
/*
		if (i!=0)
			{
				time(&t1);
				if(glb.opt.sl_pause)
					count=1000L*max( 0 , (long)glb.opt.sl_ptime - (t1-t2) );
				else
					count=0;
				evnt_timer( (int)(count&0xFFFFUL),(int)(count>>16) );
			}
*/
	}


	Dsetdrv(old_drv);
	Dsetpath(old_path);
	return Fin;
}
示例#24
0
ex_paths()
{
#if DISKFLAG
	int done,mstate,edit_obj,exit_obj;
	register int i,temp;
#define NPATHS 7
	char *ptr[NPATHS];
	static int obj[NPATHS]= {
		PATHCNX,PATHMAC,PATHTEM,PATHLDAT,PATHRDAT,PATHMIDI,PATHMULT
	};
	static int *drive[NPATHS]= {
		&cnx_drive,&mac_drive,&tem_drive,
		&ldat_drive,&rdat_drive,&midi_drive,&mlt_drive
	};
	static char *path[NPATHS]= {
		cnx_path,mac_path,tem_path,
		ldat_path,rdat_path,midi_path,mlt_path
	};
	static int findobj[NPATHS]= {
		FINDCNX,FINDMAC,FINDTEM,FINDLDAT,FINDRDAT,FINDMIDI,FINDMULT
	};
	static char *title[NPATHS]= {
		FINDCNXMSG,FINDMACMSG,FINDTEMMSG,FINDLDATMSG,
		FINDRDATMSG,FINDMIDIMSG,FINDMULTMSG
	};
	static char *ext[NPATHS]= {
		CNXF_EXT, MAXC_EXT, TE_EXT, ALL_EXT, ALL_EXT, ALL_EXT, MLX_EXT
	};
	char filename[13],pathname[80];

	for (i=0; i<NPATHS; i++)
	{
		ptr[i]= pathaddr[obj[i]].ob_spec;
		ptr[i][0]= 'A' + *drive[i];
		ptr[i][1]= ':';
		strcpy(ptr[i]+2,path[i]);
	}
	/* draw dialog box, centered */
	putdial(pathaddr,-1,0);
	
	edit_obj= -1;
	done=0;
	do
	{
		waitmouse();	/* no mouse repeat */
		exit_obj= my_form_do(pathaddr,&edit_obj,&mstate,0,&dummy);
		switch (exit_obj)
		{
			case OKPATH:
			for (i=0; i<NPATHS; i++)
			{
				if (ptr[i][1]==':')
				{
					temp= ptr[i][0]-'A';
					if ((temp>=0)&&(temp<16)) *drive[i]=temp;
					strcpy(path[i],ptr[i]+2);
				}
				else
					strcpy(path[i],ptr[i]);
			}
			case CANPATH:		done=1; break;

			default:
			for (i=0; i<NPATHS; i++) if (exit_obj==findobj[i]) break;
			putdial(0L,0,exit_obj);
			Dsetdrv(ptr[i][0]-'A');
			if (ptr[i][1]==':')
				dsetpath(ptr[i]+2);
			else
				dsetpath(ptr[i]);
			filename[0]=0;
			if (getfile(pathname,filename,ext[i],title[i]))
			{
				ptr[i][0]= (temp=Dgetdrv()) + 'A';
				ptr[i][1]= ':';
				Dgetpath(ptr[i]+2,temp+1);
				if (!ptr[i][2])
				{
					ptr[i][2]='\\';
					ptr[i][3]=0;
				}
			}
			putdial(pathaddr,-1,0);

		}	/* end switch */
	}
	while (!done);
	putdial(0L,0,exit_obj);

#endif
}  /* end ex_paths() */
示例#25
0
/* ------------ */
main()
{
register int which; 										/* Ausgel�ste Aktion */
register int i; 												/* Schleifenindex */
int msg[8]; 														/* Message-Buffer */
int dummy;															/* f�r unwichtige Werte */

appl_init();
open_vwork();

fnt_path[0] = Dgetdrv() + 'A';					/* Aktuellen Pfad ermitteln*/
fnt_path[1] = ':';
Dgetpath(fnt_path + 2, 0);
strcat(fnt_path, "\\*.FNT");

rsrc_load("VDI_FONT.RSC");							/* RSC laden */

graf_mouse(ARROW, 0L);									/* Mauspfeil */

set_workarea(); 												/* Hintergrund anlegen */
count_defined();
set_marker(); 													/* Marker positionieren */
restore_char(); 												/* Erstes Zeichen holen */
show_ccharacter();

do
	{
	which = evnt_multi(MU_BUTTON|MU_KEYBD|MU_MESAG,
										 2, 1, 1,
										 0, 0, 0, 0, 0,
										 0, 0, 0, 0, 0,
										 msg,
										 0, 0,
										 &mousex, &mousey, &dummy,
										 &dummy, &key, &clicks);


	switch(which)
		{
		case MU_KEYBD:											/* Tastendruck ? */
			if ((char)key >= 'a' && (char)key <= 'z')
				key &= 0xDF;
				
			if (!(char)key) 									/* Kontrolltaste ?*/
				{
				key >>= 8;
				key |= 0x80;
				}

			for (i = 0; i < KEY_NUM; i++)					/* Passenden Men�eintrag suchen */
				if (m_keys[i] == (char)key)
					{
					which = MU_MESAG;
					msg[0] = MN_SELECTED;
					msg[4] = m_entry[i];
					menu_action(msg); 						/* Men�eintrag ausf�hren */
					break;
					}
			break;

		case MU_MESAG:
			if (msg[0] == MN_SELECTED)				/* Men�eintrag ? */
				{
				menu_action(msg);
				menu_tnormal(menu_adr, msg[3], TRUE);
				}
			break;

		case MU_BUTTON:
			button_click(); 									/* Mausklick */
			break;
		}

	}while(which != MU_MESAG || msg[0] != MN_SELECTED || msg[4] != F_OK);

cls_vwork();
appl_exit();
}
示例#26
0
int
open_file( WX **pwx, int *pvw, int *pvh )
{
	WX		*wx;
	char	file[14], *ppath;
	int		i, ret;
	DTA		mydta, *savedta;
	long	readamt;
	char	*readbuf;

	if( (wx = calloc( 1L, sizeof(WX) )) == NULL ) {
		return (int)ENSMEM;
	}

	wx->name[0] = (char)Dgetdrv() + 'A';
	wx->name[1] = ':';
	Dgetpath( &(wx->name[2]), 0 );
	strcat( wx->name, "\\*.*" );
	file[0] = 0;

	ret = fsel_input( wx->name, file, &i );
	if( ret != 1 )  {
		goto err1;
	} else if( !i ) {
		ret = (int)ERROR;
		goto err1;
	}
	if( (ppath = strrchr( wx->name, '\\' )) == NULL ) ppath = wx->name;
	else ++ppath;
	strcpy( ppath, file );

	savedta = Fgetdta();
	Fsetdta( &mydta );
	Fsfirst( wx->name, 1 );
	Fsetdta( savedta );

	if( (readbuf = (char *)Malloc(mydta.d_length)) <= NULL ) {
		ret = (int)ENSMEM;
		goto err1;
	}

	if( (ret = (int)Fopen(wx->name, 0)) < 0 ) goto err;

	graf_mouse( BUSYBEE, NULL );
	readamt = Fread( ret, mydta.d_length, readbuf );
	graf_mouse( ARROW, NULL );
	Fclose( ret );
	if( readamt != mydta.d_length ) {
		ret = (int)readamt;
err:	Mfree( readbuf );
err1:	free( wx );
		return ret;
	}
	wx->tabs = 4 * form_alert( 1, "[2][ What size tabs? ][ 4 | 8 ]" );

	graf_mouse( BUSYBEE, NULL );
	ret = parse_buf( readbuf, readamt, wx->tabs, &wx->line0, pvw, pvh );
	graf_mouse( ARROW, NULL );
	Mfree( readbuf );
	if( ret != E_OK ) {
		free_tlines( wx->curline );
		goto err1;
	}
	*pwx = wx;
	return ret;
}