#include "emcmotcfg.h"
#include "emcmot.h"
Include dependency graph for emcmotutil.c:
Go to the source code of this file.
Functions | |
char | __attribute__ ((unused)) ident[]="$Id |
int | emcmotErrorPut (EMCMOT_ERROR *errlog, const char *error) |
int | emcmotErrorGet (EMCMOT_ERROR *errlog, char *error) |
|
Definition at line 24 of file emcmotutil.c. 00024 : emcmotutil.c,v 1.4 2001/06/11 17:57:22 wshackle Exp $"; 00025 00026 int emcmotErrorInit(EMCMOT_ERROR *errlog) 00027 { 00028 if (errlog == 0) { 00029 return -1; 00030 } 00031 00032 errlog->head = 0; 00033 errlog->start = 0; 00034 errlog->end = 0; 00035 errlog->num = 0; 00036 errlog->tail = 0; 00037 00038 return 0; 00039 } |
|
Definition at line 77 of file emcmotutil.c. Referenced by usrmotReadEmcmotError().
00078 { 00079 char *p1; 00080 const char *p2; 00081 int i; 00082 if (errlog == 0 || 00083 errlog->num == 0) { 00084 /* empty */ 00085 return -1; 00086 } 00087 00088 errlog->head++; 00089 00090 // strncpy(error, errlog->error[errlog->start], EMCMOT_ERROR_LEN); 00091 // replaced strncpy with manual copy 00092 p1=error; 00093 p2=errlog->error[errlog->start]; 00094 i=0; 00095 while(*p2 && i < EMCMOT_ERROR_LEN) 00096 { 00097 *p1 = *p2; 00098 p1++; 00099 p2++; 00100 i++; 00101 } 00102 *p1=0; 00103 00104 00105 errlog->start = (errlog->start + 1) % EMCMOT_ERROR_NUM; 00106 errlog->num--; 00107 00108 errlog->tail = errlog->head; 00109 00110 return 0; 00111 } |
|
Definition at line 41 of file emcmotutil.c. Referenced by reportError().
00042 { 00043 char *p1; 00044 const char *p2; 00045 int i; 00046 00047 if (errlog == 0 || 00048 errlog->num == EMCMOT_ERROR_NUM) { 00049 /* full */ 00050 return -1; 00051 } 00052 00053 errlog->head++; 00054 00055 // strncpy(errlog->error[errlog->end], error, EMCMOT_ERROR_LEN); 00056 // replaced strncpy with manual copy 00057 p1=errlog->error[errlog->end]; 00058 p2=error; 00059 i=0; 00060 while(*p2 && i < EMCMOT_ERROR_LEN) 00061 { 00062 *p1 = *p2; 00063 p1++; 00064 p2++; 00065 i++; 00066 } 00067 *p1=0; 00068 00069 errlog->end = (errlog->end + 1) % EMCMOT_ERROR_NUM; 00070 errlog->num++; 00071 00072 errlog->tail = errlog->head; 00073 00074 return 0; 00075 } |