?? r2util.c
字號(hào):
/*====================================================================*/
/* UNIT : @(#)r2util.c 2.5 - 08/04/99 */
/*====================================================================*/
/* PURPOSE: General purpose routines. */
/* */
/* SYSTEM : RECON II */
/* */
/* USED BY: main(), ReadTestData(), BuildCompList(), SelectComp(), */
/* and AnnotateSource(). */
/* */
/* HISTORY: */
/* VER DATE AUTHOR DESCRIPTION */
/* 1.00 23 Feb 93 L. Richard Created unit. */
/* 1.01 10 Mar 93 L. Richard Added SetTalk() and SetDirectory() */
/* 1.02 26 Mar 93 L. Richard Added Function SplitPath() */
/* 1.03 22 Jun 93 L. Richard Altered SetDirectory() and */
/* SplitPath() to allow for different */
/* operating system path definitions. */
/* 7 Nov 93 N. Wilde To implement the output sets option*/
/* added GetOutputMode and updated */
/* Usage() and SetTalk */
/* 24 Nov 96 E. Martinez To implement a structure for */
/* command line arguments */
/* and remove RECON2 env variable */
/* 22 Mar 97 L. Landry Added functions to read new trace */
/* W. Flood file format and error check the */
/* trace file date. */
/* 2.2 31 Jan 98 W. Hall Deleted SetDirectory(). */
/* Amended GetOutputMode() and Usage()*/
/* Modified EvalValueType(), */
/* getSwitchValue(), and SeekOut() to */
/* clean up some compiler warning */
/* issues. */
/* 2.3 9 Mar 99 D. Fralish Add new 'E' value to EvalValueType */
/* as per Tisk 38 */
/*--------------------------------------------------------------------*/
/*==[ INTERFACE ]=====================================================*/
#include "r2.h"
#include "r2util.h"
#include <stdio.h>
/* Globals */
int gTALK; /* Display level */
STRING gRECON2[MAXDIR];
/*==[ PRIVATE IMPLEMENTATION ]========================================*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/*==[ PUBLIC IMPLEMENTATION ]=========================================*/
/*--------------------------------------------------------------------*/
/* FUNCTION AbortMsg */
/*--------------------------------------------------------------------*/
/* PURPOSE Display error message and abort. */
/* */
/* HISTORY: */
/* VER DATE AUTHOR DESCRIPTION */
/* 1.00 23 Feb 93 L. Richard Created function. */
/*--------------------------------------------------------------------*/
extern void AbortMsg(
STRING *msg
)
{
if (0 < gTALK)
printf( "R2Analyz: ABORTING - %s\n", msg );
exit( EXIT_FAILURE );
} /* AbortMsg() */
/*--------------------------------------------------------------------*/
/* FUNCTION GetOutputMode */
/*--------------------------------------------------------------------*/
/* PURPOSE Checks the -O command line parameter to see if */
/* output is the annotated listing (default) or */
/* the set output report */
/* */
/* HISTORY: */
/* VER DATE AUTHOR DESCRIPTION */
/* 5 Nov 93 N. Wilde Created function. */
/* 24 Nov 96 E. Martinez Modified for command line arg str */
/* 2.2 31 Jan 98 W. Hall Changed the -Os switch -s in */
/* accordance with changes to the */
/* command line parameters in */
/* r2analyz.c */
/*--------------------------------------------------------------------*/
extern OUTPUT_MODE GetOutputMode(
clinput *CLInput /* Cmd line arguments */
)
{
OUTPUT_MODE result = ANNOTATED_LISTING; /* Default */
if ( 0 == strcmp(CLInput->outmode, "-s"))
result = SETS;
return result;
}
/* GetOutputMode */
/*--------------------------------------------------------------------*/
/* FUNCTION SplitPath */
/*--------------------------------------------------------------------*/
/* PURPOSE Duplicate the Borland functionality of 'fnsplit' */
/* but return only the name portion. */
/* */
/* HISTORY: */
/* VER DATE AUTHOR DESCRIPTION */
/* 1.00 26 Mar 93 L. Richard Created function. */
/* 1.01 22 Jun 93 L. Richard Added conditionals for Ops System */
/*--------------------------------------------------------------------*/
extern void SplitPath(
char *path, /* Path to be parsed */
char *name /* Name portion of path */
)
{
char drv[ MAXDRIVE ]; /* Drive portion of path */
char dir[ MAXDIR ]; /* Directory portion of path */
char fil[ MAXFILE ]; /* Name portion of path */
char ext[ MAXEXT ]; /* Extension portion of path */
char *temp; /* Tempory string pointer */
drv[0] = '\0';
dir[0] = '\0';
fil[0] = '\0';
ext[0] = '\0';
/* Extract drive including ':' */
if (NULL != (temp = strrchr( path, ':' )))
{
strncat( drv, path, 2 );
path = ++temp;
}
/* Extract complete directory path including path delimiter */
#ifdef SYS_DOS /* 1.01 [LHR] */
if (NULL != (temp = strrchr( path, '\\' )))
#endif
#ifdef SYS_UNIX /* 1.01 [LHR] */
if (NULL != (temp = strrchr( path, '/' )))
#endif
#ifdef SYS_VMS /* 1.01 [LHR] */
if (NULL != (temp = strrchr( path, ']' )))
#endif
{
strncat( dir, path, (++temp - (char *) path) );
path = temp;
}
/* Extract name and extension */
if (NULL == (temp = strrchr( path, '.' )))
strcpy( fil, path );
else
{
strncat( fil, path, (temp - (char *) path) );
strcpy( ext, temp );
}
/* Copy name portion of path */
strcpy( name, fil );
} /* SplitPath()*/
/*--------------------------------------------------------------------*/
/* FUNCTION SetTalk */
/*--------------------------------------------------------------------*/
/* PURPOSE Sets the program global variable gTALK to control */
/* the level of message display. */
/* */
/* HISTORY: */
/* VER DATE AUTHOR DESCRIPTION */
/* 1.00 10 Mar 93 L. Richard Created function. */
/* 24 Nov 96 E. Martinez Allows for command line arg struc */
/* 25 Nov 98 D. Fralish Use R2_VERS as per Tisk 33 */
/*--------------------------------------------------------------------*/
extern void SetTalk(
clinput *CLInput /* Cmd line arguments */
)
{
gTALK = 1;
if ( 0 == strcmp(CLInput->talk, "-q"))
gTALK = 0; /* Quiet */
else if ( 0 == strcmp(CLInput->talk, "-v"))
gTALK = 2; /* Verbose */
if (0 < gTALK)
printf( "\n\nR2Analyz: Version %s\n", R2_VERS );
} /* SetTalk() */
/*--------------------------------------------------------------------*/
/* FUNCTION SetDirectory */
/*--------------------------------------------------------------------*/
/* PURPOSE Reads the command line argument to get the */
/* analysis file and set the gRECON2 variable */
/* */
/* HISTORY: */
/* VER DATE AUTHOR DESCRIPTION */
/* 1.00 10 Mar 93 L. Richard Created function. */
/* 1.01 22 Jun 93 L. Richard Added conditionals for Ops System */
/* 01 Dec 96 L. Landry Added the ability to read the */
/* Command line structure */
/* 2.2 31 Jan 98 W. Hall Deleted in tisk 24 because it was */
/* no longer needed. This header */
/* remains only for documentation */
/* purposes. The call to this function*/
/* in r2analyz.c was also deleted. */
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
/* FUNCTION Usage */
/*--------------------------------------------------------------------*/
/* PURPOSE: Displays program usage. */
/* */
/* HISTORY: */
/* VER DATE AUTHOR DESCRIPTION */
/* 1.00 10 May 93 L. Richard Created function. */
/* 01 Dec 96 L. Landry Modified to simply print usage. */
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -