예제 #1
0
void  modify_fname()

{
   int   button;
   char  f_path[200], f_file[32], ext[] = "\\*.*";

   strncpy (f_path, path, 200);
   f_path[196] = '\0';

   if (strrchr (f_path, '\\')) {
        strcpy (strrchr (f_path, '\\'), ext);
        strncpy (f_file, strrchr (path, '\\') + 1, 32);
        f_file[31] = '\0';
      }
     else {
        strcat (strrchr (path, '\\'), ext);
        f_file[0] = '\0';
      }

   if (_GemParBlk.global[0] >= 0x0140)
        fsel_exinput (f_path, f_file, & button, "Choose Log File");
     else
        fsel_input (f_path, f_file, &button);

   if (button == 0)   return;

   strncpy (path, f_path, 250);

   if (strrchr (path, '\\'))
        strncpy (strrchr (path, '\\') + 1, f_file, 32);
     else
        strcat (strrchr (path, '\\'), f_file);

   create_path();
 }
예제 #2
0
int ReadScreen( void )
{
  char name[FNSIZE], directory[FMSIZE];
  short button;
  int f, status;
  	  
  status = 0;
  getcd( 0, directory);
  strcat( directory, "\\*.NEO");
  *name = 0;
  fsel_exinput( directory, name, &button, "L„s NEO-sk„rm");
  if (button == 1)
  {
  	*(strrchr( directory, '\\')+1) = 0;
    strcat( directory, name);
    f = open( directory, O_RDONLY | O_RAW, 0);
    if (f >= 0)
    {
      if (filelength( f) == 32128)
      {
        read( f, Physbase(), 128);
        read( f, Physbase(), 32000);
        status = 1;
      }
      else
        form_alert( 1, "[3][Ej NeoChrome fil][Ok]");
      close( f);
    }
    else
      form_alert( 1, "[3][Filen finns inte][Ok]");
  }
  return status;
}
예제 #3
0
WORD get_file(WORD label)
{
	WORD	butn, ii;
	BYTE	tmp_path[64], tmp_name[13];
		
	if ( !sav_rcspath[0] )
		get_defpath(tmp_path, "*.RSC");
	else
		strcpy(tmp_path, sav_rcspath);
	tmp_name[0] = '\0';

#if GEMDOS
	if (Sversion() >= 0x0140)
	{
		LONG	fs_label;

		fs_label = string_addr(label);
		fsel_exinput(ADDR(&tmp_path[0]), ADDR(&tmp_name[0]), &butn, (BYTE FAR *)fs_label);
	}
	else
#endif
		fsel_input(ADDR(&tmp_path[0]), ADDR(&tmp_name[0]), &butn);
	graf_mouse(rcs_mform, 0x0L);
	if (butn)
	{
		if (!tmp_name[0])
			if (hndl_alert(1, string_addr(NOFNAME)) == 1)
				return(FALSE);
		if (strcmp(sav_rcspath, tmp_path))
		{
#if GEMDOS
			Dsetpath((const char *)ADDR(tmp_path));
#else
			dos_chdir(ADDR(tmp_path));
#endif
			strcpy(sav_rcspath, tmp_path);
		}
		strcpy(rcs_rfile, &tmp_path[0]);
	 	for (ii = 0; rcs_rfile[ii] && rcs_rfile[ii] != '*'; ii++)
	 		;
	  	rcs_rfile[ii - 1] = NULL;	/* knock off slash */
		strcat(rcs_rfile, "\\");
		strcpy(&rsc_path[1], rcs_rfile);
		rsc_path[0] = strlen(rcs_rfile);
	  	strcat(rcs_rfile, &tmp_name[0]);
		/* Force 'rsc' extension on resource file.*/
			r_to_xfile(rcs_rfile, "RSC"); 
		r_to_xfile(rcs_dfile, "DFN");
		return (TRUE);
	} /* if butn */
	else
		return (FALSE);
} /* get_file */
예제 #4
0
/* Ask the user to find the Mail directory to be examined */
int get_mail_path(void)
{
	char path[FMSIZE],dirname[FMSIZE],select[FMSIZE],temp[80];
	int button;

	strcpy( select, "*.*" );
	sprintf( dirname, "%s\\%s", program_path, select );
	fsel_exinput( dirname, select, &button, "Locate MAIL Directory" );
	if (button) {
		stcgfp( path, dirname );
		strcpy( mail_path, path );
	/*	sprintf( mail_path, "%s\\%s", path, select ); */
		sprintf( temp, "[0][Your Mail directory is:|%s][OK|Cancel]", mail_path );
		if (form_alert( 1, temp )==1) {	chdir( path ); } else { button=0; }
	}
	return(button);
}
예제 #5
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);
}
예제 #6
0
/*******************************************************************************
	_fselect
********************************************************************************
	int _fselect(char *pfname,char *pname,char *fname,char *ext,char *title)

	Funktion:	Ruft den FileSelector in komfortabler Art und Weise auf. Dabei
					kann man alle Parts (Filename, Pathname, etc.) einzeln
					�bergeben. Man kann aber auch Pathname und den kompletten Namen
					in `pfname' �bergeben. Diese Routine sucht sich schon das, was
					ihr fehlt in bestimmten Grenzen selbst heraus.
					Diese Funktion unterst�tzt den FSEL-Cookie und l�uft
					auch ohne Selectric.

	Parameter:	*pfname	Enth�lt abschlie�end den fertigen Pfad, den
								man sofort in ein `open' einsetzen kann.
					*pname	Der Startpfad (ohne Wildcards!).
					*fname	Ein voreingestellte Filenamen.
					*ext		Eine Extension.
					*title	Einen Boxtitel. Dabei wird a) die TOS-Version
								als auch der FSEL-Cookie �berpr�ft.

	Return:		Der Button mit dem der Selector verlassen wurde.

	Bemerkung:	Beim Aufruf aus Accessories nicht vergessen ein
					BEG/END_UPDATE um diesen Aufruf zu legen!!!!!!!!!!
					Die meisten File-Selector Clones (incl. Selectric)
					machen das eh, nicht aber das Original ...
*******************************************************************************/
int _fselect(char *pfname,char *pname,char *fname,char *ext,char *title)
{
	int		but;
	char		*p;

	if (!fname[0])
	{
		p=strrchr(pfname,'\\');
		if (p)
			strcpy(fname,p+1);
		else
			strcpy(fname,pfname);
	}
	if (!pname[0])
	{
		p=strrchr(pfname,'\\');
		if (p)
		{
			p[1]='\0';
			strcpy(pname,pfname);
		}
	}
	else if (pname[strlen(pname)-1] != '\\')
		strcat(pname,"\\");
	strcat(pname,ext);

	wind_update(BEG_MCTRL);
	form_dial(FMD_START,0,0,0,0,glb.aes.desk.x,glb.aes.desk.y,glb.aes.desk.w,glb.aes.desk.h);
	if (_fsel_check() || (_vTOS() >= 0x0104))
		fsel_exinput(pname,fname,&but,title);
	else
		fsel_input(pname,fname,&but);
	form_dial(FMD_FINISH,0,0,0,0,glb.aes.desk.x,glb.aes.desk.y,glb.aes.desk.w,glb.aes.desk.h);
	_clearAesBuffer();
	wind_update(END_MCTRL);

	p=strrchr(pname,'\\');
	if (p)
		*p='\0';
	strcpy(pfname,pname);
	strcat(pfname,"\\");
	strcat(pfname,fname);
	return but;
}
예제 #7
0
int load_reg_file(void)
{
    char filename[MAXSTRING],filepath[MAXSTRING];
    FILE *file;
    short dummy;

    strcpy(filepath,system_dir);
    strcat(filepath,"*.DAT");
    strcpy(filename,"REGISTER.DAT");
    fsel_exinput(filepath, filename, &dummy,"Load Registration Key");
    if(!dummy)
        return(FALSE);

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

    file=fopen(filepath,"rb");
    if(file==NULL)
    {
        sprintf(fel.text,alerts[E_OPEN_FILE],filepath,"load_reg_file()");
        log(NULL);
        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);
}
예제 #8
0
void check_path_win(const RESULT svar)
{
#ifdef LOGGING
Log(LOG_FUNCTION,"check_path_win(...)\n");
#endif

  if((svar.type==WINDOW_CLICKED)&&(svar.data[SVAR_WINDOW_MESSAGE]==WM_CLOSED))
  {
    close_dialog(&path_win);
  }
  else if(svar.type==DIALOG_CLICKED)
    switch(svar.data[SVAR_OBJECT])
    {
      case PATH_CHOOSE_MAIL:
        sprintf(tempvar.tempstring,"Mailclient|%s|%s|%s|-%s",MAILTYPE_T_ANTMAIL,MAILTYPE_T_NEWSIE,MAILTYPE_T_INFITRA,MAILTYPE_T_MYMAIL);
        tempconf.mailtype=popup(tempvar.tempstring,tempconf.mailtype,path_win.dialog,PATH_CHOOSE_MAIL,path_win.dialog[PATH_CHOOSE_MAIL].ob_spec);
        button(&path_win, PATH_CHOOSE_MAIL, CLEAR_STATE, SELECTED,TRUE);
        break;
      case PATH_NEWSDIR:
        strcpy(tempvar.lastpath,tempconf.newsdir);
        strcpy(tempvar.lastfile,"*.*");
        fsel_exinput(tempvar.lastpath,tempvar.lastfile,(short *)&tempvar.tempcounter,(char *)alerts[FS_NEWSDIR]);
        if(tempvar.tempcounter)
        {
          strcpy(tempconf.newsdir,tempvar.lastpath);
          ((char *)strrchr(tempconf.newsdir,'\\'))[1]='\0';
          str2ted(path_win.dialog,PATH_NEWSDIR,tempconf.newsdir);
          button(&path_win, PATH_NEWSDIR,UPDATE,NOLL,TRUE);
        }
        break;
      case PATH_EDITOR:
        if(strrchr(tempconf.editor,'\\')!=NOLL)
        {
          strcpy(tempvar.lastpath,tempconf.editor);
          ((char *)strrchr(tempvar.lastpath,'\\'))[1]='\0';
          strcat(tempvar.lastpath,"*.*");
          strcpy(tempvar.lastfile,strrchr(tempconf.editor,'\\')+1);
        }
        else
        {
          strcpy(tempvar.lastpath,system_dir);
          strcat(tempvar.lastpath,"*.*");
          strcpy(tempvar.lastfile,"");
        }
        fsel_exinput(tempvar.lastpath,tempvar.lastfile,(short *)&tempvar.tempcounter,(char *)alerts[FS_EDITOR]);
        if(tempvar.tempcounter)
        {
          strcpy(tempconf.editor,tempvar.lastpath);
          ((char *)strrchr(tempconf.editor,'\\'))[1]='\0';
          strcat(tempconf.editor,tempvar.lastfile);
          str2ted(path_win.dialog,PATH_EDITOR,tempvar.lastfile);
          button(&path_win, PATH_EDITOR,UPDATE,NOLL,TRUE);
        }
        break;
      case PATH_NNTP:
        if(strrchr(tempconf.nntpd,'\\')!=NOLL)
        {
          strcpy(tempvar.lastpath,tempconf.nntpd);
          ((char *)strrchr(tempvar.lastpath,'\\'))[1]='\0';
          strcat(tempvar.lastpath,"*.*");
          strcpy(tempvar.lastfile,strrchr(tempconf.nntpd,'\\')+1);
        }
        else
        {
          strcpy(tempvar.lastpath,system_dir);
          strcat(tempvar.lastpath,"*.*");
          strcpy(tempvar.lastfile,"");
        }
        fsel_exinput(tempvar.lastpath,tempvar.lastfile,(short *)&tempvar.tempcounter,(char *)alerts[FS_NNTP]);
        if(tempvar.tempcounter)
        {
          strcpy(tempconf.nntpd,tempvar.lastpath);
          ((char *)strrchr(tempconf.nntpd,'\\'))[1]='\0';
          strcat(tempconf.nntpd,tempvar.lastfile);
          str2ted(path_win.dialog,PATH_NNTP,tempvar.lastfile);
          button(&path_win, PATH_NNTP,UPDATE,NOLL,TRUE);
        }
        break;
      case PATH_MAILDATA:
        if(strrchr(tempconf.maildata,'\\')!=NOLL)
        {
          strcpy(tempvar.lastpath,tempconf.maildata);
          ((char *)strrchr(tempvar.lastpath,'\\'))[1]='\0';
          strcat(tempvar.lastpath,"*.*");
          strcpy(tempvar.lastfile,strrchr(tempconf.maildata,'\\')+1);
        }
        else
        {
          strcpy(tempvar.lastpath,system_dir);
          strcat(tempvar.lastpath,"*.*");
          strcpy(tempvar.lastfile,"");
        }
        if(tempconf.mailtype==MAILTYPE_ANTMAIL)
          fsel_exinput(tempvar.lastpath,tempvar.lastfile,(short *)&tempvar.tempcounter,(char *)alerts[FS_ANTMAIL]);
        else if(tempconf.mailtype==MAILTYPE_NEWSIE)
          fsel_exinput(tempvar.lastpath,tempvar.lastfile,(short *)&tempvar.tempcounter,(char *)alerts[FS_NEWSIE]);
        else if(tempconf.mailtype==MAILTYPE_INFITRA)
          fsel_exinput(tempvar.lastpath,tempvar.lastfile,(short *)&tempvar.tempcounter,(char *)alerts[FS_INFITRA]);
        else if(tempconf.mailtype==MAILTYPE_MYMAIL)
          fsel_exinput(tempvar.lastpath,tempvar.lastfile,(short *)&tempvar.tempcounter,(char *)alerts[FS_MYMAIL]);
        if(tempvar.tempcounter)
        {
          strcpy(tempconf.maildata,tempvar.lastpath);
          ((char *)strrchr(tempconf.maildata,'\\'))[1]='\0';
          strcat(tempconf.maildata,tempvar.lastfile);
          str2ted(path_win.dialog,PATH_MAILDATA,tempvar.lastfile);
          button(&path_win, PATH_MAILDATA,UPDATE,NOLL,TRUE);
        }
        break;
      case PATH_SIGNATUR:
        if(strrchr(tempconf.signature,'\\')!=NOLL)
        {
          strcpy(tempvar.lastpath,tempconf.signature);
          ((char *)strrchr(tempvar.lastpath,'\\'))[1]='\0';
          strcat(tempvar.lastpath,"*.*");
          strcpy(tempvar.lastfile,strrchr(tempconf.signature,'\\')+1);
        }
        else
        {
          strcpy(tempvar.lastpath,system_dir);
          strcat(tempvar.lastpath,"*.*");
          strcpy(tempvar.lastfile,"");
        }
        fsel_exinput(tempvar.lastpath,tempvar.lastfile,(short *)&tempvar.tempcounter,(char *)alerts[FS_SIGNATURE]);
        if(tempvar.tempcounter)
        {
          strcpy(tempconf.signature,tempvar.lastpath);
          ((char *)strrchr(tempconf.signature,'\\'))[1]='\0';
          strcat(tempconf.signature,tempvar.lastfile);
          str2ted(path_win.dialog,PATH_SIGNATUR,tempvar.lastfile);
          button(&path_win,PATH_SIGNATUR,UPDATE,NOLL,TRUE);
        }
        break;
      case PATH_OK:
        strcpy(config.nntpd,tempconf.nntpd);
        strcpy(config.editor,tempconf.editor);
        ted2str(path_win.dialog,PATH_STRINGSERV,config.stringserver);
        
        if(strcmp(config.maildata, tempconf.maildata)||(config.mailtype!=tempconf.mailtype))
        {
          strcpy(config.maildata,tempconf.maildata);
          if(tempconf.mailtype==MAILTYPE_ANTMAIL)
            load_antmail();
          else if(tempconf.mailtype==MAILTYPE_NEWSIE)
            load_newsie();
          else if(tempconf.mailtype==MAILTYPE_INFITRA)
            load_infitra();
          else if(tempconf.mailtype==MAILTYPE_MYMAIL)
            load_mymail();
        }
        else
          strcpy(config.maildata,tempconf.maildata);
        config.mailtype=tempconf.mailtype;
        if(strcmp(config.newsdir,tempconf.newsdir))
        {
          if(msglist_win.status!=WINDOW_CLOSED)
            close_msglistwin();
          if(read_win.status!=WINDOW_CLOSED)
            close_readwin();
          if(sublist_win.status!=WINDOW_CLOSED)
            close_sublistwin();
          if(unsublist_win.status!=WINDOW_CLOSED)
            close_unsublistwin();
          close_dialog(&server_win);
          if(active.ungroups)
            free(active.ungroups),active .ungroups=NULL;
          free_list(&active.mlist);
          menu_ienable(menu_tree,MENU_REPLY_E,FALSE); 
          menu_ienable(menu_tree,MENU_REPLY_G,FALSE);
          menu_ienable(menu_tree,MENU_WRITE_NEW,FALSE); 
          menu_ienable(menu_tree,MENU_CHANGE_MESS,FALSE); 
          menu_ienable(menu_tree,MENU_SAVE_MESS,FALSE);
          menu_ienable(menu_tree,MENU_DEL_FLAGS,FALSE);
          menu_ienable(menu_tree,MENU_SET_FLAGS,FALSE);
          strcpy(config.newsdir,tempconf.newsdir);
          load_active();
        }  
        else
          strcpy(config.newsdir,tempconf.newsdir);
        strcpy(config.signature,tempconf.signature);
        button(&path_win, PATH_OK, CLEAR_STATE, SELECTED,TRUE);
        close_dialog(&path_win);
        break;
      case PATH_CANCEL:
        button(&path_win, PATH_CANCEL, CLEAR_STATE, SELECTED,FALSE);
        close_dialog(&path_win);
        break;
      default:;
    }
 
  Return;
}
예제 #9
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);
    }
  }
}