Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,133 @@
/*%% (c) Copyright 1993, 1994 Hewlett-Packard Company */
/*%% (c) Copyright 1993, 1994 International Business Machines Corp. */
/*%% (c) Copyright 1993, 1994 Sun Microsystems, Inc. */
/*%% (c) Copyright 1993, 1994 Novell, Inc. */
/*%% $XConsortium: tttar_utils.h /main/3 1995/10/20 17:01:53 rswiston $ */
/*
* tttar_utils.h - Utilities for the ToolTalk archive tool.
*
* Copyright (c) 1990 by Sun Microsystems, Inc.
*/
#ifndef _LSTAR_UTILS_H
#define _LSTAR_UTILS_H
#include <api/c/tt_c.h>
#include <util/tt_string.h>
/*
* External Variables
*/
extern Tt_status err_noted; // Used by note_err() macro.
extern char *ptr_returned; // Used by note_ptr_err() macro.
extern void *voidptr_returned; // Used by note_voidptr_err() macro.
extern Tt_message msg_returned; // Used by note_msg_err() macro.
extern int int_returned; // Used by note_int_err() macro.
extern char our_process_name[];
/*
* Constants
*/
/*
* STRING_EQUAL() - Check 2 strings for equality.
*/
#define STRING_EQUAL(s1,s2) ( strcmp( s1, s2 ) == 0 )
/*
* NULL_OR_EMPTY() - Is this string ptr NULL or empty?
*/
#define NULL_OR_EMPTY(p) (( (char *)p == NULL ) || ( *(char *)p == '\0' ))
/*
* IS_TT_ERR() - Is this Tt_status neither TT_OK nor a TT_WARN?
*/
#define IS_TT_ERR(err) ( err > TT_WRN_LAST )
/*
* stringify() - Turn a macro argument into a string.
* gross Reiserism, use # in ANSI C
*/
#if defined(__STDC__)
#define stringify(s) #s
#else
/* gross Reiserism, use # in ANSI C */
#define stringify(s) "s"
#endif
/*
* note_err() - Note any error corresponding to this Tt_status
* expression, returning the error code
*/
#define note_err(expression) \
( ( TT_OK == ( err_noted = expression)) \
? TT_OK \
: note_error( err_noted, stringify(expression), \
__FILE__, __LINE__ ))
/*
* note_ptr_err() - Assign the (char *) expression to ptr_returned,
* noting any error on stderr if error isn't TT_OK, and
* return the error code
*/
#define note_ptr_err(expression) \
( ( TT_OK \
== ( err_noted = \
tt_pointer_error(ptr_returned = expression))) \
? TT_OK \
: note_error( err_noted, stringify(expression), \
__FILE__, __LINE__ ))
/*
* note_int_err() - Assign the (int) expression to int_returned,
* noting any error on stderr if error isn't TT_OK, and
* return the error code
*/
#define note_int_err(expression) \
( ( TT_OK \
== ( err_noted = \
tt_int_error(int_returned = expression))) \
? TT_OK \
: note_error( err_noted, stringify(expression), \
__FILE__, __LINE__ ))
/*
* note_msg_err() - Assign the expression to msg_returned,
* noting any error on stderr if error isn't TT_OK, and
* return the error code
*/
#define note_msg_err(expression) \
( ( TT_OK \
== ( err_noted = \
tt_pointer_error(msg_returned = expression))) \
? TT_OK \
: note_error( err_noted, stringify(expression), \
__FILE__, __LINE__ ))
/*
* note_voidptr_err() - Assign the expression to voidptr_returned,
* noting any error on stderr if error isn't TT_OK, and
* return the error code
*/
#define note_voidptr_err(expression) \
( ( TT_OK \
== ( err_noted = \
tt_pointer_error(voidptr_returned = expression))) \
? TT_OK \
: note_error( err_noted, stringify(expression), \
__FILE__, __LINE__ ))
/*
* Procedure declarations
*/
Tt_status note_error( Tt_status error, char *expression,
char *file, int line );
void my_tt_free( caddr_t p );
void my_tt_release( int mark );
bool_t in_list( _Tt_string s, _Tt_string_list_ptr list );
#endif /* _LSTAR_UTILS_H */