home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / programming / gnuc / library / rcs / __make_link.c,v < prev    next >
Encoding:
Text File  |  1992-07-04  |  2.0 KB  |  96 lines

  1. head    1.1;
  2. access;
  3. symbols
  4.     version39-41:1.1;
  5. locks;
  6. comment    @ *  @;
  7.  
  8.  
  9. 1.1
  10. date    92.05.14.19.55.40;    author mwild;    state Exp;
  11. branches;
  12. next    ;
  13.  
  14.  
  15. desc
  16. @signal save MakeLink() function (or alike)
  17. @
  18.  
  19.  
  20. 1.1
  21. log
  22. @Initial revision
  23. @
  24. text
  25. @/*
  26.  *  This file is part of ixemul.library for the Amiga.
  27.  *  Copyright (C) 1991, 1992  Markus M. Wild
  28.  *
  29.  *  This library is free software; you can redistribute it and/or
  30.  *  modify it under the terms of the GNU Library General Public
  31.  *  License as published by the Free Software Foundation; either
  32.  *  version 2 of the License, or (at your option) any later version.
  33.  *
  34.  *  This library is distributed in the hope that it will be useful,
  35.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  36.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  37.  *  Library General Public License for more details.
  38.  *
  39.  *  You should have received a copy of the GNU Library General Public
  40.  *  License along with this library; if not, write to the Free
  41.  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  42.  *
  43.  *  $Id$
  44.  *
  45.  *  $Log$
  46.  */
  47.  
  48. #define KERNEL
  49. #include "ixemul.h"
  50.  
  51. #if __GNUC__ != 2
  52. #define alloca __builtin_alloca
  53. #endif
  54.  
  55. #ifndef ACTION_MAKE_LINK
  56. #define ACTION_MAKE_LINK 1021
  57. #endif
  58.  
  59. struct link_vec {
  60.   BPTR target;
  61.   int  link_mode;
  62. };
  63.  
  64. static int
  65. __link_func (struct StandardPacket *sp, struct MsgPort *handler,
  66.              BPTR parent_lock,
  67.          BSTR name,
  68.          struct link_vec *lv, int *no_error)
  69. {
  70.   sp->sp_Pkt.dp_Type = ACTION_MAKE_LINK;
  71.   sp->sp_Pkt.dp_Arg1 = parent_lock;
  72.   sp->sp_Pkt.dp_Arg2 = name;
  73.   sp->sp_Pkt.dp_Arg3 = lv->target;
  74.   sp->sp_Pkt.dp_Arg4 = lv->link_mode;
  75.   
  76.   PutPacket (handler, sp);
  77.   __wait_sync_packet (sp);
  78.   
  79.   *no_error = sp->sp_Pkt.dp_Res1 == -1;
  80.   
  81.   /* shouldn't be possible to get the ERR_SOFT_LINK here.. */
  82.   return 0;
  83. }
  84.  
  85. int 
  86. __make_link (char *path, BPTR targ, int mode)
  87. {
  88.   struct link_vec lv;
  89.   
  90.   lv.target = targ;
  91.   lv.link_mode = mode;
  92.   
  93.   return __plock (path, __link_func, &lv);
  94. }
  95. @
  96.