Date: Fri, 20 Feb 1998 01:00:01 +0000 From: "V Edward Gold, Jr." <vegold01@starbase.spd.louisville.edu> To: freebsd-current@FreeBSD.ORG Subject: problems with XView and FreeBSD Message-ID: <34ECD591.41C67EA6@starbase.spd.louisville.edu>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
I just recently started playing with an application that was written
originally on SunOS 4.1.3 and I ported it to FreeBSD 2.2.1 and
everything was fine. I upgraded to 3.0 and now I experience problems
apparently caused by using the notify_do_dispatch() call and ANY
subsequent file I/O. I went ahead and attached the sample program that
demonstrates this oddity, in case anyone wants to help me locate its
source/cure. I compile it as follows:
gcc -o main main.c -I/usr/X11R6/include -g -L/usr/X11R6/lib -lxview
\ -lX11 -lolgx
Any help would be appreciated!
Ed
[-- Attachment #2 --]
#include <stdio.h>
#include <stdlib.h>
#include <xview/xview.h>
#include <xview/canvas.h>
#include <xview/panel.h>
#include <xview/cms.h>
#include <xview/notice.h>
#include <xview/tty.h>
#include <xview/termsw.h>
#include <xview/cursor.h>
#include <xview/xv_xrect.h>
#define TEXT_HEIGHT ( 200 )
#define TEXT_WIDTH ( 800 )
#define BUTTON_HEIGHT ( 40 )
#define MAX_SCRIPT_LEVELS ( 20 )
/******************************************************************************/
/*** Global XWindow Structures ***/
/******************************************************************************/
typedef struct
{
int frame_height;
int frame_width;
Frame frame;
Display *display;
Panel panel;
Xv_window window;
Tty tty;
int tty_fd;
} WinEnv;
WinEnv BaseWin;
main( int argc, char **argv )
{
char msg[1024], prompt[1024], **cmd_word;
int i, status;
BaseWin.frame_height = 512;
BaseWin.frame_width = 512;
xv_init( XV_INIT_ARGC_PTR_ARGV, &argc, argv, 0 );
BaseWin.frame = xv_create( (Xv_opaque) NULL, FRAME,
FRAME_LABEL, "XImgEdit Version 1.1, January 1997",
XV_SHOW, TRUE,
FRAME_SHOW_LABEL, TRUE,
FRAME_INHERIT_COLORS, TRUE,
FRAME_SHOW_FOOTER, TRUE,
FRAME_LEFT_FOOTER, "Copyright (c) 1997",
WIN_ERROR_MSG, "Error creating base frame!",
XV_WIDTH, TEXT_WIDTH,
XV_HEIGHT, TEXT_HEIGHT + BUTTON_HEIGHT,
0 );
BaseWin.display = (Display *) xv_get( BaseWin.frame, XV_DISPLAY );
XFlush( BaseWin.display );
BaseWin.tty = xv_create( BaseWin.frame, TERMSW,
WIN_INHERIT_COLORS, TRUE,
TTY_ARGV, TTY_ARGV_DO_NOT_FORK,
WIN_X, 0,
WIN_Y, BUTTON_HEIGHT,
NULL );
xv_set( BaseWin.tty,
WIN_CONSUME_EVENTS,
WIN_NO_EVENTS,
LOC_WINENTER,
LOC_WINEXIT,
NULL,
NULL );
window_fit_width( BaseWin.frame );
BaseWin.tty_fd = (int) xv_get( BaseWin.tty, TTY_TTY_FD );
dup2( BaseWin.tty_fd, fileno( stdout ) );
dup2( BaseWin.tty_fd, fileno( stdin ) );
BaseWin.panel = xv_create( BaseWin.frame, PANEL,
XV_HEIGHT, BUTTON_HEIGHT,
WIN_X, 0,
WIN_Y, 0,
0 );
notify_do_dispatch();
printf( "\nYour Prompt Here!\n" );
/*** I default your prompt to ";", but you can change it ***/
strcpy( prompt, ";" );
while( 1 )
{
char cmd_buffer[1024];
sprintf( msg, prompt );
write( fileno( stdout ), msg, strlen( msg ) );
fflush( stdout );
while( read( fileno(stdin), sizeof(cmd_buffer), cmd_buffer ) != 0 );
}
free( cmd_word );
}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?34ECD591.41C67EA6>
