2009-04-22 14:31:23 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 by Maurus Cuelenaere
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __PLUGINLIB_EXIT_H__
|
|
|
|
#define __PLUGINLIB_EXIT_H__
|
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
/* make sure we are in sync with the real definitions, especially on
|
|
|
|
* hosted systems */
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "gcc_extensions.h"
|
2009-04-22 14:31:23 +00:00
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
/* these are actually implemented in plugin_crt0.c which all plugins link */
|
|
|
|
extern int atexit(void (*func)(void));
|
|
|
|
extern void exit(int status) NORETURN_ATTR;
|
|
|
|
/* these don't call the exit handlers */
|
|
|
|
extern void _exit(int status) NORETURN_ATTR;
|
|
|
|
/* C99 version */
|
|
|
|
#define _Exit _exit
|
2010-08-23 17:12:26 +00:00
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
#ifndef EXIT_SUCCESS
|
|
|
|
#define EXIT_SUCCESS 0
|
|
|
|
#define EXIT_FAILURE 1
|
|
|
|
#endif
|
2010-08-23 17:12:26 +00:00
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
/**
|
|
|
|
* helper function to handle USB connected events coming from
|
|
|
|
* button_get()
|
|
|
|
*
|
|
|
|
* it will exit the plugin if usb is detected, but it will call the atexit func
|
|
|
|
* before actually showing the usb screen
|
|
|
|
*
|
|
|
|
* it additionally handles power off as well, with the same behavior
|
|
|
|
*/
|
|
|
|
extern void exit_on_usb(int button);
|
2009-04-22 14:31:23 +00:00
|
|
|
|
|
|
|
#endif /* __PLUGINLIB_EXIT_H__ */
|