home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / XAP / XFILEMAN / XFILEMAN.TAR / xfilemanager / action_link.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-22  |  3.3 KB  |  133 lines

  1. /*
  2.  * Copyright 1993 by Ove Kalkan, Cremlingen, Germany
  3.  *
  4.  * Permission to use, copy, modify, distribute and sell this software and it's
  5.  * documentation for any purpose is hereby granted without fee, rpovided that
  6.  * the above copyright notice and this permission appear in supporting
  7.  * documentation, and that the name of Ove Kalkan not to be used in
  8.  * advertising or publicity pertaining to distributiopn of the software without
  9.  * specific, written prior permission. Ove Kalkan makes no representations
  10.  * about the suitability of this software for any purpose. It is provided
  11.  * as is without express or implied warranty.
  12.  *
  13.  * OVE KALKAN DISPLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  14.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABLILITY AND FITNESS, IN NO
  15.  * EVENT SHALL OVE KALKAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  16.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  17.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18.  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19.  * PERFORMANCE OF THIS SOFTWARE.
  20.  *
  21.  * $Header: filename,v 1.0 yyyy/mm/dd hh:mm:ss loginname Exp $
  22.  */
  23.  
  24. #ifndef COHERENT
  25. #include "global.h"
  26.  
  27. /*
  28.  * Global variables
  29.  */
  30.  
  31.  
  32. /*********************************************************
  33.  * name:    init_link
  34.  * description:    erzeugt ein Fenster mit 2 texten zum Linken
  35.  * input:    char *from, char *to;
  36.  * output:    none
  37.  * date:    10.5.93
  38.  *********************************************************/
  39. void    init_link (char *from, char *to)
  40. {
  41.     Widget    but;
  42.  
  43.     /*
  44.      * Das Dialogfenster erzeugen
  45.      */
  46.     NO_MULTI = TRUE;
  47.     but = makeDialog(2,"Linkname :","Linktarget :",from,to,"Symbolic Link Creator",TRUE,FALSE,Icon_Link_PM);
  48.     XtAddCallback(but,XtNcallback,(XtCallbackProc) exec_link_cb,NULL);
  49.  
  50.     /*
  51.      * Zum Schluss die Dialogshell managen
  52.      */
  53.     XtManageChild (dialog);
  54.  
  55.     /*
  56.      * Max und Minsize setzen
  57.      */
  58.     setSize();
  59. }
  60.  
  61.  
  62. /*********************************************************
  63.  * name:    exec_copy_cb
  64.  * description:    Link-Funktion ausfuehren
  65.  * input:    none
  66.  * output:    none
  67.  * date:    14.6.93
  68.  *********************************************************/
  69. void    exec_link_cb (void)
  70. {
  71.     char    *from, *to;
  72.     Arg    args[1];
  73.  
  74.     /*
  75.      * Die Texte der beiden Textfelder holen
  76.      */
  77.     XtSetArg(args[0],XtNstring,&from);
  78.     XtGetValues(text_1,args,1);
  79.  
  80.     XtSetArg(args[0],XtNstring,&to);
  81.     XtGetValues(text_2,args,1);
  82.  
  83.     /*
  84.      * Ueberpruefen ob in beiden ein Text steht, sonst
  85.      * Warnung ausgeben
  86.      */
  87.     if (!strlen(from) || !strlen(to)) {
  88.         WARNING ("Insuffisant Arguments.\nOperation aborted.");
  89.         return;
  90.     }
  91.     exec_link(from,to);
  92. }
  93.  
  94.  
  95. /*********************************************************
  96.  * name:    exec_link
  97.  * description:    einen symbolischen Link erzeugen
  98.  * input:    none
  99.  * output:    none
  100.  * date:    14.6.93
  101.  *********************************************************/
  102. void    exec_link (char *from, char *to)
  103. {
  104.     char    buf[1024];
  105.  
  106.     /*
  107.      * Befehl generieren und ausfuehren
  108.      */
  109.     sprintf(buf,"%s %s %s",LINK_CMD,to,from);
  110.     system(buf);
  111.     {
  112.         /*
  113.          * Dialogfenster loeschen
  114.          */
  115.         if (dialog)
  116.             XtDestroyWidget(dialog);
  117.         dialog = NULL;
  118.  
  119.         /*
  120.          * Hier muss ein Update der veranderten Felder kommen
  121.          * Bisher unvollstaendig
  122.          */
  123.         /* Zielfolder und Dir refreshen, falls vorhanden */
  124.         refreshFolderByPathname (from);
  125. #ifdef    HAS_QUOTA
  126.         showQuota(quota_label);
  127. #endif
  128.     }
  129. }
  130.  
  131.  
  132. #endif
  133.