cmcdiscard.c revision 550
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* Copyright 1990 Sun Microsystems, Inc. All rights reserved.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* Use subject to license terms.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* Permission is hereby granted, free of charge, to any person obtaining a
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* copy of this software and associated documentation files (the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* "Software"), to deal in the Software without restriction, including
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* without limitation the rights to use, copy, modify, merge, publish,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* distribute, and/or sell copies of the Software, and to permit persons
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* to whom the Software is furnished to do so, provided that the above
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* copyright notice(s) and this permission notice appear in all copies of
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* the Software and that both the above copyright notice(s) and this
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* permission notice appear in supporting documentation.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* Except as contained in this notice, the name of a copyright holder
8d96b23e24cf8db8618f698bfa580a25d7dc6029Alan Wright* shall not be used in advertising or otherwise to promote the sale, use
8d96b23e24cf8db8618f698bfa580a25d7dc6029Alan Wright* or other dealings in this Software without prior written authorization
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw* of the copyright holder.
8d96b23e24cf8db8618f698bfa580a25d7dc6029Alan Wright*
8d96b23e24cf8db8618f698bfa580a25d7dc6029Alan Wright*/
8d96b23e24cf8db8618f698bfa580a25d7dc6029Alan Wright
8d96b23e24cf8db8618f698bfa580a25d7dc6029Alan Wright#ifndef lint
dc20a3024900c47dd2ee44b9707e6df38f7d62a5asstatic char sccsid[] = "@(#)cmcdiscard.c 35.3 08/09/30";
8d96b23e24cf8db8618f698bfa580a25d7dc6029Alan Wright#endif
8d96b23e24cf8db8618f698bfa580a25d7dc6029Alan Wright
8d96b23e24cf8db8618f698bfa580a25d7dc6029Alan Wright
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#include <sys/fcntl.h>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#include <X11/Xlib.h>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#include "cmc.h"
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#include "cmcutil.h"
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw** Removes the file containing the shared workspace colors,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw** if it exists.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw*/
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
dc20a3024900c47dd2ee44b9707e6df38f7d62a5asvoid
dc20a3024900c47dd2ee44b9707e6df38f7d62a5ascmc_discard ()
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as{
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as char *filename = comp_colors_filename(basename);
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (unlink(filename) < 0)
8d96b23e24cf8db8618f698bfa580a25d7dc6029Alan Wright fatal_error("cannot remove file '%s'", filename);
8d96b23e24cf8db8618f698bfa580a25d7dc6029Alan Wright}
8d96b23e24cf8db8618f698bfa580a25d7dc6029Alan Wright