/****************************************************************************1* Copyright (c) 1998 Free Software Foundation, Inc. *2* *3* Permission is hereby granted, free of charge, to any person obtaining a *4* copy of this software and associated documentation files (the *5* "Software"), to deal in the Software without restriction, including *6* without limitation the rights to use, copy, modify, merge, publish, *7* distribute, distribute with modifications, sublicense, and/or sell *8* copies of the Software, and to permit persons to whom the Software is *9* furnished to do so, subject to the following conditions: *10* *11* The above copyright notice and this permission notice shall be included *12* in all copies or substantial portions of the Software. *13* *14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *15* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *16* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *17* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *18* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *19* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *20* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *21* *22* Except as contained in this notice, the name(s) of the above copyright *23* holders shall not be used in advertising or otherwise to promote the *24* sale, use or other dealings in this Software without prior written *25* authorization. *26****************************************************************************/2728/****************************************************************************29* Author: Juergen Pfeifer <[email protected]> 1995,1997 *30****************************************************************************/3132#include "form.priv.h"3334MODULE_ID("$Id$")3536/*---------------------------------------------------------------------------37| Facility : libnform38| Function : FIELD *link_field(FIELD *field, int frow, int fcol)39|40| Description : Duplicates the field at the specified position. The41| new field shares its buffers with the original one,42| the attributes are independent.43| If an error occurs, errno is set to44|45| E_BAD_ARGUMENT - invalid argument46| E_SYSTEM_ERROR - system error47|48| Return Values : Pointer to the new field or NULL if failure49+--------------------------------------------------------------------------*/50FIELD *link_field(FIELD * field, int frow, int fcol)51{52FIELD *New_Field = (FIELD *)0;53int err = E_BAD_ARGUMENT;5455if (field && (frow>=0) && (fcol>=0) &&56((err=E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */57(New_Field = (FIELD *)malloc(sizeof(FIELD))) )58{59*New_Field = *_nc_Default_Field;60New_Field->frow = frow;61New_Field->fcol = fcol;62New_Field->link = field->link;63field->link = New_Field;64New_Field->buf = field->buf;65New_Field->rows = field->rows;66New_Field->cols = field->cols;67New_Field->nrow = field->nrow;68New_Field->nbuf = field->nbuf;69New_Field->drows = field->drows;70New_Field->dcols = field->dcols;71New_Field->maxgrow= field->maxgrow;72New_Field->just = field->just;73New_Field->fore = field->fore;74New_Field->back = field->back;75New_Field->pad = field->pad;76New_Field->opts = field->opts;77New_Field->usrptr = field->usrptr;78if (_nc_Copy_Type(New_Field,field))79return New_Field;80}8182if (New_Field)83free_field(New_Field);8485SET_ERROR( err );86return (FIELD *)0;87}8889/* fld_link.c ends here */909192