X-Git-Url: http://matita.cs.unibo.it/gitweb/?p=helm.git;a=blobdiff_plain;f=helm%2Fhelmpot%2Fmain.c;fp=helm%2Fhelmpot%2Fmain.c;h=0000000000000000000000000000000000000000;hp=c2abc2d7eea98dda5cdc524d08fec4e6b05b1c25;hb=1696761e4b8576e8ed81caa905fd108717019226;hpb=5325734bc2e4927ed7ec146e35a6f0f2b49f50c1 diff --git a/helm/helmpot/main.c b/helm/helmpot/main.c deleted file mode 100644 index c2abc2d7e..000000000 --- a/helm/helmpot/main.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2000-2002, Luca Padovani . - * - * This file is part of HelmPot, a minimal browser for HELM. - * - * HelmPot 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. - * - * HelmPot 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 HelmPot; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * For details, see the HelmPot World-Wide-Web page, - * http://cs.unibo.it/helm/helmpot, or send a mail to - * - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "defs.h" -#include "guiGTK.h" - -#define BUFFER_SIZE 2048 - -PRIVATE gchar app_name[64]; -PRIVATE gint sockfd; -PRIVATE struct sockaddr_in address; - -PRIVATE void -error(const gchar* msg) -{ - g_assert(msg != NULL); - fprintf(stderr, "%s: fatal error: %s\n", app_name, msg); -} - -#if 0 -PRIVATE void -print_version() -{ - printf("%s - written by Luca Padovani (C) 2000.\n", app_name); -#ifdef DEBUG - printf("Compiled %s %s\n", __DATE__, __TIME__); -#endif - exit(0); -} -#endif - -PRIVATE gboolean -timeout(gpointer user_data) -{ - static gchar file_name[BUFFER_SIZE]; - - if (recv(sockfd, file_name, BUFFER_SIZE, 0) < 0) { - if (errno != EAGAIN && errno != EWOULDBLOCK) - error("error receving message"); - } else - GUI_load_document(file_name); - - return TRUE; -} - -int -main(int argc, char *argv[]) -{ - sprintf(app_name, "HELM Pot (Plug-OuT) v%s", VERSION); - - if (argc != 2) { - fprintf(stderr, "%s\n\n", app_name); - fprintf(stderr, "Usage: helmpot URL\n"); - exit(-1); - } - - sockfd = socket(PF_INET, SOCK_DGRAM, 0); - if (sockfd < 0) error("could not create socket"); - - if (inet_aton("127.0.0.1", &address.sin_addr) < 0) - error("could not create address"); - address.sin_port = 8778; - address.sin_family = PF_INET; - - if (bind(sockfd, &address, sizeof(address)) < 0) { - if (sendto(sockfd, argv[1], strlen(argv[1]), 0, &address, sizeof(address)) < 0) - error("could not send message"); - sleep(1); - exit(0); - } - - if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0) - error("could not set the socket to non-block mode"); - - GUI_init(&argc, &argv, app_name, 500, 600, timeout, 500); - - GUI_load_document(argv[1]); - - GUI_run(); - GUI_uninit(); - GUI_unload_document(); - - return 0; -}