~ubuntu-branches/ubuntu/raring/gdis/raring-proposed

« back to all changes in this revision

Viewing changes to host.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Leidert (dale)
  • Date: 2009-04-06 17:12:18 UTC
  • mfrom: (3.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090406171218-uizoe126jrq09ytt
Tags: 0.90-1
* New upstream release 0.90.
* Acknowledge NMU (closes: #492994). Thanks to Neil Williams.

* makefile.debian: Upstream doesn't provide a Makefile to edit - so created
  our own.
* debian/compat: Added and set to be 5.
* debian/control: Added Homepage, Vcs* and DM-Upload-Allowed fields.
  (Maintainer): Set to the debichem team with approval by Noèl.
  (Uploaders): Added myself.
  (Build-Depends): Increased debhelper version to 5. Removed glutg3-dev.
  Added dpatch.
  (Standards-Version): Bumped to 3.8.1.
  (Description): Removed homepage. Fixed a typo.
* debian/copyright: Updated, completed and adjusted.
* debian/dirs: Dropped useless file.
* debian/docs: Renamed to debian/gdis.docs.
* debian/menu: Renamed to debian/gdis.menu.
  (section): Fixed accordingly to policy.
* debian/gdis.1: Just some formatting changes.
* debian/gdis.desktop: Added file (with small fixes) provided by Phill Bull
  (LP: #111353).
* debian/gdis.install: Added.
* debian/rules: Cleaned. Installation is now done by dh_install. Make sure,
  the CVS directory is not copied. Added dh_desktop call.
* debian/source.lintian-overrides: makefile.debian is created for Debian but
  lives outside debian/.
* debian/watch: Added.
* debian/README.build: Dropped.
* debian/README.source: Added to be compliant to the policy v3.8.
* debian/patches/Debian_make.dpatch: Added.
  - gdis.h (ELEM_FILE): Moved fix for gdis.elemts path (#399132) to this
    patch.
* debian/patches/00list: Added.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (C) 2003 by Sean David Fleming
 
3
 
 
4
sean@ivec.org
 
5
 
 
6
This program is free software; you can redistribute it and/or
 
7
modify it under the terms of the GNU General Public License
 
8
as published by the Free Software Foundation; either version 2
 
9
of the License, or (at your option) any later version.
 
10
 
 
11
This program is distributed in the hope that it will be useful,
 
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
GNU General Public License for more details.
 
15
 
 
16
You should have received a copy of the GNU General Public License
 
17
along with this program; if not, write to the Free Software
 
18
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
19
 
 
20
The GNU GPL can also be found at http://www.gnu.org
 
21
*/
 
22
 
 
23
#ifndef _WIN32
 
24
 
 
25
#include <stdio.h>
 
26
#include <stdlib.h>
 
27
#include <string.h>
 
28
#include <unistd.h>
 
29
 
 
30
#include "gdis.h"
 
31
#include "scan.h"
 
32
#include "host.h"
 
33
 
 
34
/* top level data structure */
 
35
extern struct sysenv_pak sysenv;
 
36
 
 
37
/* NB: this host stuff could equally well be the localhost, */
 
38
/* instead of some remote host ... in which case the system() */
 
39
/* call could be used instead of piping commands via the input */
 
40
/* and output file descriptors */
 
41
 
 
42
/* NB: remote stuff, where we issue commands - assumes unix */
 
43
/* style host ie echo, date, cd ... etc are all assumed to work */
 
44
 
 
45
struct host_pak 
 
46
{
 
47
gchar *name;
 
48
gchar *cwd;
 
49
gint type;         /* unix only at the moment */
 
50
gint connected;
 
51
gint input;
 
52
gint output;
 
53
 
 
54
/* NEW */
 
55
/* if qsub & mpirun services available - permits alternate invocation */
 
56
gpointer services;
 
57
};
 
58
 
 
59
struct service_pak 
 
60
{
 
61
gpointer host;
 
62
gint flags;
 
63
gchar *fullpath;
 
64
};
 
65
 
 
66
/**************************/
 
67
/* line reading primitive */
 
68
/**************************/
 
69
int readstr(int fd, char *a, int n)
 
70
{
 
71
int i;
 
72
        
 
73
for (i=0; i<n; i++)
 
74
  {
 
75
  if (read(fd, a+i, 1) != 1)
 
76
    return -1;
 
77
 
 
78
  if (a[i] == '\n')
 
79
    {
 
80
    a[i] = 0;
 
81
    return i;
 
82
    }
 
83
  }
 
84
return n;
 
85
}
 
86
 
 
87
/**********************/
 
88
/* free a service pak */
 
89
/**********************/
 
90
void host_service_free(gpointer data)
 
91
{
 
92
struct service_pak *service = data;
 
93
 
 
94
g_free(service->fullpath);
 
95
g_free(service);
 
96
}
 
97
 
 
98
/**********************************/
 
99
/* allocate a new host connection */
 
100
/**********************************/
 
101
gpointer host_new(gchar *name)
 
102
{
 
103
struct host_pak *host;
 
104
 
 
105
host = g_malloc(sizeof(struct host_pak));
 
106
 
 
107
host->name = g_strdup(name);
 
108
host->cwd = NULL;
 
109
host->connected = FALSE;
 
110
host->input = -1;
 
111
host->output = -1;
 
112
host->services = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, host_service_free);
 
113
 
 
114
return(host);
 
115
}
 
116
 
 
117
/****************************************/
 
118
/* disconnect and free a host structure */
 
119
/****************************************/
 
120
void host_free(gpointer data)
 
121
{
 
122
struct host_pak *host = data;
 
123
 
 
124
if (host)
 
125
  {
 
126
  if (host->connected)
 
127
    host_disconnect(host);
 
128
 
 
129
  g_free(host->name);
 
130
  g_free(host->cwd);
 
131
  g_hash_table_destroy(host->services);
 
132
  g_free(host);
 
133
  }
 
134
}
 
135
 
 
136
/*************************/
 
137
/* free all host entries */
 
138
/*************************/
 
139
void host_free_all(void)
 
140
{
 
141
GSList *list;
 
142
 
 
143
list = sysenv.host_list;
 
144
while (list)
 
145
  {
 
146
  host_free(list->data);
 
147
  list = g_slist_next(list);
 
148
  }
 
149
g_slist_free(sysenv.host_list);
 
150
}
 
151
 
 
152
/*************************************************/
 
153
/* perform a foreach on the host's program table */
 
154
/*************************************************/
 
155
void host_service_foreach(gpointer data, gpointer func, gpointer arg)
 
156
{
 
157
struct host_pak *host = data;
 
158
 
 
159
g_assert(host != NULL);
 
160
 
 
161
g_hash_table_foreach(host->services, func, arg);
 
162
}
 
163
 
 
164
/*******************************/
 
165
/* structure access primitives */
 
166
/*******************************/
 
167
const gchar *host_name(gpointer data)
 
168
{
 
169
struct host_pak *host = data;
 
170
 
 
171
g_assert(host != NULL);
 
172
 
 
173
return(host->name);
 
174
}
 
175
 
 
176
const gchar *host_cwd(gpointer data)
 
177
{
 
178
struct host_pak *host = data;
 
179
 
 
180
g_assert(host != NULL);
 
181
 
 
182
return(host->cwd);
 
183
}
 
184
 
 
185
gpointer host_service_get(gpointer data, const gchar *name)
 
186
{
 
187
struct host_pak *host = data;
 
188
 
 
189
g_assert(host != NULL);
 
190
 
 
191
return(g_hash_table_lookup(host->services, name));
 
192
}
 
193
 
 
194
gchar *host_service_fullpath(gpointer data)
 
195
{
 
196
struct service_pak *service = data;
 
197
 
 
198
return(service->fullpath);
 
199
}
 
200
 
 
201
gint host_service_flags(gpointer data)
 
202
{
 
203
struct service_pak *service = data;
 
204
 
 
205
return(service->flags);
 
206
}
 
207
 
 
208
/*****************************************/
 
209
/* cycle through service execution types */
 
210
/*****************************************/
 
211
void host_service_cycle(gpointer data, const gchar *name)
 
212
{
 
213
struct host_pak *host = data;
 
214
struct service_pak *service;
 
215
 
 
216
service = g_hash_table_lookup(host->services, name);
 
217
if (!service)
 
218
  return;
 
219
 
 
220
/* don't cycle support services (eg qsub/mpi) */
 
221
if (service->flags == SERVICE_SECONDARY)
 
222
  return;
 
223
 
 
224
/* cycle the service type */
 
225
service->flags++;
 
226
if (service->flags >= SERVICE_PRIMARY)
 
227
  service->flags = SERVICE_BACKGROUND;
 
228
}
 
229
 
 
230
/**********************************************************************************/
 
231
/* check if a service name (and current flags) is available for the supplied host */
 
232
/**********************************************************************************/
 
233
gint host_service_available(gpointer data)
 
234
{
 
235
struct service_pak *service = data, *mpi, *qsub;
 
236
struct host_pak *host;
 
237
 
 
238
g_assert(service != NULL);
 
239
if (!service->fullpath)
 
240
  return(FALSE);
 
241
 
 
242
host = service->host;
 
243
mpi = g_hash_table_lookup(host->services, "mpirun");
 
244
qsub = g_hash_table_lookup(host->services, "qsub");
 
245
 
 
246
switch (service->flags)
 
247
  {
 
248
  case SERVICE_MPI:
 
249
    if (!mpi->fullpath)
 
250
      return(FALSE);
 
251
    break;
 
252
  case SERVICE_QSUB:
 
253
    if (!qsub->fullpath)
 
254
      return(FALSE);
 
255
    break;
 
256
  case SERVICE_QSUB_MPI:
 
257
    if (!mpi->fullpath || !qsub->fullpath)
 
258
      return(FALSE);
 
259
    break;
 
260
  }
 
261
 
 
262
return(TRUE);
 
263
}
 
264
 
 
265
/***************************************************/
 
266
/* primitive for populating the host program table */
 
267
/***************************************************/
 
268
/* NB: like all, assumes unix host */
 
269
void host_service_find(struct host_pak *host, const gchar *name)
 
270
{
 
271
gint flags;
 
272
gchar *text, *reply;
 
273
struct service_pak *service;
 
274
 
 
275
g_assert(host != NULL);
 
276
g_assert(name != NULL);
 
277
 
 
278
/* sepcial case services */
 
279
if (g_strrstr(name, "mpi") || g_strrstr(name, "qsub"))
 
280
  flags = SERVICE_SECONDARY;
 
281
else
 
282
  flags = SERVICE_BACKGROUND;
 
283
 
 
284
/* attempt to locate executable */
 
285
text = g_strdup_printf("which %s\n", name);
 
286
reply = host_talk(host, text);
 
287
g_free(text);
 
288
 
 
289
if (g_strrstr(reply, "not found"))
 
290
  {
 
291
  g_free(reply);
 
292
  reply = NULL;
 
293
  }
 
294
 
 
295
/* add the service */
 
296
service = g_malloc(sizeof(struct service_pak));
 
297
service->host = host;
 
298
service->flags = flags;
 
299
service->fullpath = reply;
 
300
 
 
301
g_hash_table_insert(host->services, g_strdup(name), service);
 
302
}
 
303
 
 
304
/**********************************************************/
 
305
/* setup session working directory for job file transfers */
 
306
/**********************************************************/
 
307
/* NB: assumes unix style remote host */
 
308
/* TODO - check for host type etc etc - which can be reported via the job/host gui */
 
309
void host_init(struct host_pak *host)
 
310
{
 
311
gchar *date, *text, *reply;
 
312
 
 
313
date = host_talk(host, "date\n");
 
314
 
 
315
/* force existence of gdis ssh session top level directory */
 
316
reply = host_talk(host, "md gdis_ssh\n");
 
317
g_free(reply);
 
318
reply = host_talk(host, "cd gdis_ssh\n");
 
319
g_free(reply);
 
320
 
 
321
/* create a working directory using current date */
 
322
text = g_strdup_printf("md \"%s\"\n", date);
 
323
reply = host_talk(host, text);
 
324
g_free(reply);
 
325
g_free(text);
 
326
text = g_strdup_printf("cd \"%s\"\n", date);
 
327
reply = host_talk(host, text);
 
328
g_free(reply);
 
329
g_free(text);
 
330
 
 
331
 
 
332
/* NEW */
 
333
host->cwd = host_talk(host, "pwd\n");
 
334
 
 
335
 
 
336
/* create a (dummy) control file */
 
337
/* TODO (maybe) ... could be used to save/restore info about submitted jobs */
 
338
reply = host_talk(host, "echo \"1\" > control.txt\n");
 
339
g_free(reply);
 
340
 
 
341
g_free(date);
 
342
 
 
343
/* initialize available host services */
 
344
host_service_find(host, "gulp");
 
345
 
 
346
/* secondary (enabling) services */
 
347
host_service_find(host, "qsub");
 
348
host_service_find(host, "mpirun");
 
349
 
 
350
/* register the initialized host */
 
351
sysenv.host_list = g_slist_prepend(sysenv.host_list, host);
 
352
}
 
353
 
 
354
/**********************************/
 
355
/* activate a host ssh connection */
 
356
/**********************************/
 
357
/* NB: assumes unix style remote host */
 
358
gint host_connect(gpointer data)
 
359
{
 
360
int n;
 
361
int fdto[2];
 
362
int fdfrom[2];
 
363
char cmd[1000];
 
364
struct host_pak *host = data;
 
365
 
 
366
g_assert(host != NULL);
 
367
if (!host->name)
 
368
  {
 
369
  perror("Fatal: no host name.");
 
370
  return(FALSE);
 
371
  }
 
372
if (pipe(fdto) == -1 || pipe(fdfrom) == -1) 
 
373
  {
 
374
  perror("Fatal: failed to create pipes.");
 
375
  return(FALSE);
 
376
  }
 
377
 
 
378
switch (fork()) 
 
379
  {
 
380
  case -1:
 
381
    perror("Fatal: failed to fork.");
 
382
    return(FALSE);
 
383
 
 
384
/* child */
 
385
  case 0:
 
386
/* setup child io streams */
 
387
    dup2(fdto[0], fileno(stdin));
 
388
    dup2(fdfrom[1], fileno(stdout));
 
389
/* close unwanted streams */
 
390
    close(fdto[1]); 
 
391
    close(fdfrom[0]);
 
392
 
 
393
/* FIXME - can we get rid of the stdin not a terminal complaint? */
 
394
/*
 
395
    execlp("ssh", "ssh", "-e", "none", "-T", "-q", host->name, (char *) 0);
 
396
*/
 
397
 
 
398
    execlp("ssh", "ssh", "-T", "-q", host->name, (char *) 0);
 
399
 
 
400
    exit(3);
 
401
 
 
402
/* parent */
 
403
  default:
 
404
/* close unwanted streams */
 
405
    close(fdto[0]);
 
406
    close(fdfrom[1]);
 
407
 
 
408
/* send a command */
 
409
    write(fdto[1], "echo \"ssh:connect\"\n", 19);
 
410
 
 
411
/* read/write to child (ssh) via file desc. */
 
412
/* read -> fdfrom[0] */
 
413
/* write -> fdto[1] */
 
414
    for (;;)
 
415
      {
 
416
      n = readstr(fdfrom[0], cmd, sizeof(cmd));
 
417
 
 
418
      if (n > 1)
 
419
        {
 
420
/* if we get here ... we've established a connection */
 
421
/*
 
422
    printf("%s\n", cmd);
 
423
*/
 
424
        if (strstr(cmd, "ssh:connect"))
 
425
          {
 
426
          printf("Connection established.\n");
 
427
 
 
428
          host->input = fdto[1];
 
429
          host->output = fdfrom[0];
 
430
          host->connected = TRUE;
 
431
 
 
432
/* set up session working directory */
 
433
          host_init(host);
 
434
 
 
435
          break;
 
436
          }
 
437
        }
 
438
      else
 
439
        {
 
440
        host->connected = FALSE;
 
441
        return(FALSE);
 
442
        }
 
443
      }
 
444
  }
 
445
 
 
446
return(TRUE);
 
447
}
 
448
 
 
449
/************************************/
 
450
/* deactivate a host ssh connection */
 
451
/************************************/
 
452
void host_disconnect(gpointer data)
 
453
{
 
454
struct host_pak *host = data;
 
455
 
 
456
printf("Closing connection to: %s\n", host->name);
 
457
 
 
458
host->connected = FALSE;
 
459
write(host->input, "exit\n", 5);
 
460
}
 
461
 
 
462
/************************************************************/
 
463
/* send a message to remote host shell, and return response */
 
464
/************************************************************/
 
465
/* NB: assumes unix style remote host */
 
466
gchar *host_talk(gpointer data, const gchar *message)
 
467
{
 
468
gint n;
 
469
char cmd[1000];
 
470
GString *response;
 
471
struct host_pak *host = data;
 
472
 
 
473
g_assert(host != NULL);
 
474
 
 
475
if (!host->connected)
 
476
  return(NULL); 
 
477
 
 
478
write(host->input, message, strlen(message));
 
479
write(host->input, "echo \"host:done\"\n", 17);
 
480
 
 
481
response = g_string_new(NULL);
 
482
 
 
483
/* TODO - implement some form of timeout response check? */
 
484
/* if error, either we didnt connect, or host is not unix */
 
485
/* and didnt understand the echo command */
 
486
for (;;)
 
487
  {
 
488
  n = readstr(host->output, cmd, sizeof(cmd));
 
489
 
 
490
  if (n > 1)
 
491
    {
 
492
    if (strstr(cmd, "host:done"))
 
493
      break;
 
494
    else
 
495
      g_string_sprintfa(response, "%s", cmd);
 
496
    }
 
497
  }
 
498
 
 
499
return(g_string_free(response, FALSE));
 
500
}
 
501
 
 
502
/*********************************************/
 
503
/* ensure input string is safe to print/echo */
 
504
/*********************************************/
 
505
/* NB: unix shell specific */
 
506
gchar *host_safe_text(const gchar *input)
 
507
{
 
508
gint i;
 
509
GString *output;
 
510
 
 
511
if (!input)
 
512
  return(NULL);
 
513
 
 
514
output = g_string_new(NULL);
 
515
 
 
516
for (i=0 ; i<strlen(input) ; i++)
 
517
  {
 
518
  switch (input[i])
 
519
    {
 
520
/* escape special chars */
 
521
    case '$':
 
522
    case '!':
 
523
      g_string_sprintfa(output, "\\%c", input[i]);
 
524
      break;
 
525
 
 
526
    default:
 
527
/* disallow control chars */
 
528
      if (g_ascii_iscntrl(input[i]))
 
529
        break;
 
530
      g_string_sprintfa(output, "%c", input[i]);
 
531
    }
 
532
  }
 
533
 
 
534
return(g_string_free(output, FALSE));
 
535
}
 
536
 
 
537
/*****************************************/
 
538
/* write a locally stored file to a host */
 
539
/*****************************************/
 
540
/* FIXME - this works ... but is ugly and slow ... the experimental version is better */
 
541
/* (ie using ascii-xfr) but doesnt terminate properly */
 
542
gint host_file_write(gpointer data, gchar *local, gchar *remote)
 
543
{
 
544
gchar *text, *tmp, *reply;
 
545
gpointer scan;
 
546
struct host_pak *host = data;
 
547
 
 
548
g_assert(host != NULL);
 
549
 
 
550
scan = scan_new(local);
 
551
if (!scan)
 
552
  {
 
553
  printf("Error: missing local file: %s\n", local);
 
554
  return(1);
 
555
  }
 
556
 
 
557
/* create the remote file */
 
558
text = g_strdup_printf("echo -n \"\" > \"%s\"\n", remote);
 
559
 
 
560
reply = host_talk(host, text);
 
561
 
 
562
g_free(reply);
 
563
g_free(text);
 
564
 
 
565
/* concat line by line */
 
566
/* FIXME - is there a better way to do this? */
 
567
for (;;)
 
568
  {
 
569
/* escape special characters ... remove control codes */
 
570
  tmp = host_safe_text(scan_get_line(scan));
 
571
  if (scan_complete(scan))
 
572
    break;
 
573
 
 
574
  text = g_strdup_printf("echo \"%s\" >> \"%s\"\n", tmp, remote);
 
575
  g_free(tmp);
 
576
 
 
577
  reply = host_talk(host, text);
 
578
  g_free(reply);
 
579
  g_free(text);
 
580
  }
 
581
 
 
582
return(0);
 
583
}
 
584
 
 
585
/*****************************************/
 
586
/* write a locally stored file to a host */
 
587
/*****************************************/
 
588
/* PROBLEM is - doesnt seem to terminate properly */
 
589
gint host_file_write_experimental(gpointer data, gchar *local, gchar *remote)
 
590
{
 
591
gchar *text;
 
592
struct host_pak *host = data;
 
593
gpointer scan;
 
594
 
 
595
if (!host->connected)
 
596
  return(FALSE); 
 
597
 
 
598
scan = scan_new(local);
 
599
if (!scan)
 
600
  return(1);
 
601
 
 
602
text = g_strdup_printf("ascii-xfr -v -r %s\n", remote);
 
603
write(host->input, text, strlen(text));
 
604
g_free(text);
 
605
 
 
606
for (;;)
 
607
  {
 
608
  text = scan_get_line(scan);
 
609
  if (scan_complete(scan))
 
610
    {
 
611
/* FIXME - does not seem to be terminating the transfer ...  */
 
612
    write(host->input, "", 1);
 
613
    write(host->input, "", 1);
 
614
    break;
 
615
    }
 
616
  write(host->input, text, strlen(text));
 
617
  }
 
618
 
 
619
scan_free(scan);
 
620
 
 
621
return(FALSE);
 
622
}
 
623
 
 
624
/************************************************/
 
625
/* read a file on a remote host to a local file */
 
626
/************************************************/
 
627
gint host_file_read(gpointer data, gchar *local, gchar *remote)
 
628
{
 
629
gchar *text, cmd[10];
 
630
struct host_pak *host = data;
 
631
FILE *fp;
 
632
 
 
633
if (!host->connected)
 
634
  return(FALSE); 
 
635
 
 
636
text = g_strdup_printf("ascii-xfr -v -s -e %s\n", remote);
 
637
 
 
638
write(host->input, text, strlen(text));
 
639
 
 
640
fp = fopen(local, "w");
 
641
 
 
642
for (;;)
 
643
  {
 
644
  read(host->output, cmd, 1);
 
645
 
 
646
fprintf(fp, "%c", cmd[0]);
 
647
 
 
648
  if (cmd[0] == 26 || cmd[0] == '')
 
649
    {
 
650
    break;
 
651
    }
 
652
  }
 
653
 
 
654
return(FALSE);
 
655
}
 
656
 
 
657
/****************************************************/
 
658
/* simple test of the host communication primitives */
 
659
/****************************************************/
 
660
/* NB: assumes unix style remote host */
 
661
void host_test(void)
 
662
{
 
663
gpointer host;
 
664
gchar *reply;
 
665
 
 
666
host = host_new("sean@onyx.ivec.org");
 
667
 
 
668
if (host_connect(host))
 
669
  printf("host_connect(): success!\n");
 
670
else
 
671
  {
 
672
  printf("host_connect(): failed!\n");
 
673
  return;
 
674
  }
 
675
 
 
676
 
 
677
{
 
678
/*
 
679
struct host_pak *h = host;
 
680
 
 
681
write(h->input, "cat > gok.txt\n", 14);
 
682
write(h->input, "abcdef\n", 7);
 
683
*/
 
684
 
 
685
/* CURRENT - how do we terminate the redirect ... ie simulate a control-D or control-C */
 
686
/* appears there is no portable way for doing it ... can send stuff to /dev/tty in linux */
 
687
/* none of these work ... */
 
688
/*
 
689
write(h->input, (char *) '~', 1);
 
690
write(h->input, (char *) 'd', 1);
 
691
write(h->input, (char *) "^C", 2);
 
692
write(h->input, (char *) "^D", 2);
 
693
write(h->input, (char *) "", 1);
 
694
write(h->input, (char *) "", 1);
 
695
write(h->input, (char *) 27, 1);
 
696
write(h->input, (char *) "", 1);
 
697
write(h->input, (char *) 16, 1);
 
698
write(h->input, (char *) "", 1);
 
699
*/
 
700
 
 
701
}
 
702
 
 
703
/*
 
704
printf("sending: [date]\n");
 
705
reply = host_talk(host, "date\n");
 
706
printf("response: [%s]\n", reply);
 
707
g_free(reply);
 
708
*/
 
709
 
 
710
 
 
711
printf("sending: [which gulp]\n");
 
712
reply = host_talk(host, "which gulp\n");
 
713
printf("response: [%s]\n", reply);
 
714
g_free(reply);
 
715
 
 
716
/* CURRENT - using ascii-xfr to accomplish these */
 
717
/* FIXME - read then write works ... but reversing order causes a hang ... why??? */
 
718
/* seems that after a write has been done ... things are messed up */
 
719
 
 
720
/*
 
721
host_file_read(host, "dummy.txt", "/home/sean/.cshrc");
 
722
host_file_write(host, "aloh4-.car", "aloh4-copy.car");
 
723
host_file_write(host, "aloh4-.car", "aloh4-copy2.car");
 
724
*/
 
725
 
 
726
 
 
727
 
 
728
host_disconnect(host);
 
729
 
 
730
host_free(host);
 
731
}
 
732
#endif