📄 xtel.c
字号:
/* * xtel - Emulateur MINITEL sous X11 * * Copyright (C) 1991-1994 Lectra Systemes & Pierre Ficheux * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */static char rcsid[] = "$Id: xtel.c,v 1.16 1997/07/03 08:24:47 pierre Exp $";/* * programme principal */#define EXTERN#include "xtel.h"#include <X11/Shell.h>#include <stdlib.h>#include <sys/types.h>#include <sys/stat.h>#include <pwd.h>#include "patchlevel.h"#include "bitmaps/xtel.bit"#include "bitmaps/teleph.xbm"#include "bitmaps/teleph_mask.xbm"#ifndef NO_XPM#include <X11/xpm.h>#include "pixmaps/xtel.xpm"#endif /* NO_XPM */static Colormap current_cmap;static Cursor teleph_cursor;static Pixmap pixmap_icone = None;static Boolean flag_execution = False;static char *procedure_executee = NULL;static char *copyright_string = "(C)1991-97 LECTRA SYSTEMES & Pierre Ficheux";static XColor black, white;/* liste des noms des boutons MINITEL */struct definition_touche touches[] = { {"videotex", "V"}, {"teleinfo_ascii", "A"}, {"teleinfo_fr", "F"}, {"blanc", NULL}, {"envoi", "A"}, {"retour", "B"}, {"repetition", "C"}, {"guide", "D"}, {"annulation", "E"}, {"sommaire", "F"}, {"correction", "G"}, {"suite", "H"}, {"blanc", NULL}, {"connexion_fin", "I"}, };/* * Options (ressources) propres a XTEL * * -serveur *serveur specifie la machine serveur * -service *service specifie le service * -petite *petiteFonte taille de la fonte * -ng *nGris force les niveaux de gris * *commandeImpression comme son nom l'indique * *nomService nom du service tcp * -low *lowMemory pas de jolis boutons * -private *privateColormap colormap privee */static Boolean defaultFalse = False;#define XtNserveur "serveur"#define XtCServeur "Serveur"#define XtNpetiteFonte "petiteFonte"#define XtCPetiteFonte "PetiteFonte"#define XtNlowMemory "lowMemory"#define XtCLowMemory "LowMemory"#define XtNnGris "nGris"#define XtCNGris "NGris"#define XtNcommandeImpression "commandeImpression"#define XtCCommandeImpression "CommandeImpression"#define XtNcommandeImpressionAscii "commandeImpressionAscii"#define XtCCommandeImpressionAscii "CommandeImpressionAscii"#define XtNnomService "nomService"#define XtCNomService "NomService"#define XtNboutonRaccrocher "boutonRaccrocher"#define XtCBoutonRaccrocher "BoutonRaccrocher"#define XtNprivateColormap "privateColormap"#define XtCPrivateColormap "PrivateColormap"#define XtNstring1 "string1"#define XtNstring2 "string2"#define XtNstring3 "string3"#define XtNstring4 "string4"#define XtNstring5 "string5"#define XtNstring6 "string6"#define XtNstring7 "string7"#define XtNstring8 "string8"#define XtNstring9 "string9"#define XtNerreur1 "erreur1"static XtResource ressources[] = { { XtNserveur, XtCServeur, XtRString, sizeof(String), XtOffsetOf(ressources_xtel, serveur), XtRString, "ondee" }, { XtNnGris, XtCNGris, XtRBoolean, sizeof(Boolean), XtOffsetOf(ressources_xtel, nGris), XtRBoolean, (XtPointer) &defaultFalse }, { XtNpetiteFonte, XtCPetiteFonte, XtRBoolean, sizeof(Boolean), XtOffsetOf(ressources_xtel, petiteFonte), XtRBoolean, (XtPointer) &defaultFalse }, { XtNcommandeImpression, XtCCommandeImpression, XtRString, sizeof(String), XtOffsetOf(ressources_xtel, commandeImpression), XtRString, "lpr -h %s" }, { XtNcommandeImpressionAscii, XtCCommandeImpressionAscii, XtRString, sizeof(String), XtOffsetOf(ressources_xtel, commandeImpressionAscii), XtRString, "lpr -h %s" }, { XtNnomService, XtCNomService, XtRString, sizeof(String), XtOffsetOf(ressources_xtel, nomService), XtRString, "xtel" }, { XtNboutonRaccrocher, XtCBoutonRaccrocher, XtRBoolean, sizeof(Boolean), XtOffsetOf(ressources_xtel, boutonRaccrocher), XtRBoolean, (XtPointer) &defaultFalse }, { XtNlowMemory, XtCLowMemory, XtRBoolean, sizeof(Boolean), XtOffsetOf(ressources_xtel, lowMemory), XtRBoolean, (XtPointer) &defaultFalse }, { XtNprivateColormap, XtCPrivateColormap, XtRBoolean, sizeof(Boolean), XtOffsetOf(ressources_xtel, privateColormap), XtRBoolean, (XtPointer) &defaultFalse }, { XtNstring1, XtCString, XtRString, sizeof(String), XtOffsetOf(ressources_xtel, string[0]), XtRString, (XtPointer) "String 0" }, { XtNstring2, XtCString, XtRString, sizeof(String), XtOffsetOf(ressources_xtel, string[1]), XtRString, (XtPointer) "String 1" }, { XtNstring3, XtCString, XtRString, sizeof(String), XtOffsetOf(ressources_xtel, string[2]), XtRString, (XtPointer) "String 2" }, { XtNstring4, XtCString, XtRString, sizeof(String), XtOffsetOf(ressources_xtel, string[3]), XtRString, (XtPointer) "String 3" }, { XtNstring5, XtCString, XtRString, sizeof(String), XtOffsetOf(ressources_xtel, string[4]), XtRString, (XtPointer) "String 4" }, { XtNstring6, XtCString, XtRString, sizeof(String), XtOffsetOf(ressources_xtel, string[5]), XtRString, (XtPointer) "String 5" }, { XtNstring7, XtCString, XtRString, sizeof(String), XtOffsetOf(ressources_xtel, string[6]), XtRString, (XtPointer) "String 6" }, { XtNstring8, XtCString, XtRString, sizeof(String), XtOffsetOf(ressources_xtel, string[7]), XtRString, (XtPointer) "String 7" }, { XtNstring9, XtCString, XtRString, sizeof(String), XtOffsetOf(ressources_xtel, string[8]), XtRString, (XtPointer) "String 8" }, { XtNerreur1, XtCString, XtRString, sizeof(String), XtOffsetOf(ressources_xtel, erreur[0]), XtRString, (XtPointer) "Erreur 0" } };/* * Sauve l'ecran */void sauve_l_ecran (w, pevent, params, nb_params)Widget w;XEvent *pevent;String *params;Cardinal nb_params;{ videotexSauveEcran (ecran_minitel);}/* * fonction d'init */void init_xtel (){ videotexInit (ecran_minitel); clavier_minitel_valide (False); XFlush (XtDisplay(ecran_minitel));}/* Handler d'erreur X */static int xtel_X_error_handler (display, err)Display *display;XErrorEvent *err;{ char msg[80]; XGetErrorText (display, err->error_code, msg, 80); fprintf (stderr, "\n\nXTel ===> Erreur X: %s\n\n", msg); fprintf (stderr, "\tVerifiez votre environnement X, si ce comportement s'avere\n"); fprintf (stderr, "\tetre un bug de XTel, executez XTel sous debugger, posez un\n"); fprintf (stderr, "\tpoint d'arret sur la fonction \"xtel_X_error_handler\" et\n"); fprintf (stderr, "\tenvoyez le detail de la pile d'appels a \"pierre@rd.lectra.fr\".\n\n\tMerci et joyeuses Paques.\n\n"); }#ifndef NO_XPM/* Construction d'icone XPM, pique dans xpaint ! */static void SetIconImage(w)Widget w;{ static Pixmap icon = None; Window iconWindow; Screen *screen = XtScreen(w); Display *dpy = XtDisplay(w); XpmAttributes xpma; xpma.valuemask = XpmReturnInfos; /* ** Build the icon */ iconWindow = XCreateSimpleWindow(dpy, RootWindowOfScreen(screen), 0, 0, 1, 1, 0, black_pixel, black_pixel); XpmCreatePixmapFromData(dpy, iconWindow, xtel_xpm, &icon, NULL, &xpma); if (icon) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -