keyValuePair.h File Reference

Go to the source code of this file.

Defines

#define MAXKEYS   1000
#define KVP_MIN_BUFFER_SIZE   20480
#define MAX_INT_LENGTH   12
#define MAX_FLOAT_LENGTH   14

Enumerations

enum  KvpErrorCode {
  KVP_E_OK = 0, KVP_E_DUPLICATE, KVP_E_NOTFOUND, KVP_E_SYSTEM,
  KVP_E_BADKEY, KVP_E_BADVALUE, KVP_E_TOOMANY, KVP_E_TOOLONG,
  KVP_E_BADTYPE, KVP_E_BADINPUT, KVP_E_WRONGCOUNT, KVP_E_TRUNCATE,
  KVP_E_ILLNUMBER, KVP_E_TERMINATOR
}
enum  KeyType { KT_STRING, KT_FLOAT, KT_INT, KT_INVALID }

Functions

void kvpInit (int bufferSize)
int kvpParse (const char *record)
void kvpReset (void)
KvpErrorCode kvpGetEntry (int entry, char **key, KeyType *type, int *size, char **value)
char * kvpGetString (const char *key)
int kvpGetInt (const char *key, int defaultValue)
int kvpGetDec (const char *key, int defaultValue)
int kvpGetHex (const char *key, int defaultValue)
float kvpGetFloat (const char *key, float defaultValue)
double kvpGetDouble (const char *key, double defaultValue)
int kvpQueryLength (const char *key)
void kvpDumpInternals (void)
KvpErrorCode kvpSetString (const char *key, const char *value)
KvpErrorCode kvpSetInt (const char *key, int value)
KvpErrorCode kvpSetFloat (const char *key, float value)
KvpErrorCode kvpSetIntArray (const char *key, const int *values, int count)
KvpErrorCode kvpSetFloatArray (const char *key, const float *values, int count)
KvpErrorCode kvpGetIntArray (const char *key, int *values, int *entries)
KvpErrorCode kvpGetFloatArray (const char *key, float *values, int *entries)
KvpErrorCode kvpGetStringArray (const char *key, char *values, int maxlen, int *entries)
KvpErrorCode kvpUpdateInt (const char *key, int value)
int kvpWrite (int stream)
int kvpFormat (char *buffer, int length)
KvpErrorCode kvpError (void)
void kvpPrintError (KvpErrorCode code)
const char * kvpErrorString (KvpErrorCode code)

Define Documentation

#define KVP_MIN_BUFFER_SIZE   20480

Definition at line 75 of file keyValuePair.h.

Referenced by kvpInit(), and kvpRealloc().

#define MAX_FLOAT_LENGTH   14

Definition at line 78 of file keyValuePair.h.

Referenced by kvpSet(), and kvpUpdate().

#define MAX_INT_LENGTH   12

Definition at line 77 of file keyValuePair.h.

Referenced by kvpSet(), and kvpUpdate().

#define MAXKEYS   1000

Definition at line 74 of file keyValuePair.h.

Referenced by kvpParse(), and kvpSet().


Enumeration Type Documentation

enum KeyType
Enumerator:
KT_STRING 
KT_FLOAT 
KT_INT 
KT_INVALID 

Definition at line 98 of file keyValuePair.h.

00098                 {
00099       KT_STRING,
00100       KT_FLOAT,
00101       KT_INT,
00102       KT_INVALID
00103    } KeyType ;

Enumerator:
KVP_E_OK 
KVP_E_DUPLICATE 
KVP_E_NOTFOUND 
KVP_E_SYSTEM 
KVP_E_BADKEY 
KVP_E_BADVALUE 
KVP_E_TOOMANY 
KVP_E_TOOLONG 
KVP_E_BADTYPE 
KVP_E_BADINPUT 
KVP_E_WRONGCOUNT 
KVP_E_TRUNCATE 
KVP_E_ILLNUMBER 
KVP_E_TERMINATOR 

Definition at line 81 of file keyValuePair.h.

00081              {
00082    KVP_E_OK = 0,
00083    KVP_E_DUPLICATE,
00084    KVP_E_NOTFOUND,
00085    KVP_E_SYSTEM,
00086    KVP_E_BADKEY,
00087    KVP_E_BADVALUE,
00088    KVP_E_TOOMANY,
00089    KVP_E_TOOLONG,
00090    KVP_E_BADTYPE,
00091    KVP_E_BADINPUT,
00092    KVP_E_WRONGCOUNT,
00093    KVP_E_TRUNCATE,
00094    KVP_E_ILLNUMBER,
00095    KVP_E_TERMINATOR
00096 } KvpErrorCode ;


Function Documentation

void kvpDumpInternals ( void   ) 

Definition at line 175 of file keyValuePair.c.

References kvpBuffer, kvpBufferSize, nkeys, spaceLeft, and spare.

Referenced by main().

00176 {
00177    printf ("kvpBuffer=%p spare=%p kvpBufferSize=%d spaceLeft=%d nkeys=%d\n",
00178            kvpBuffer,
00179            spare,
00180            kvpBufferSize,
00181            spaceLeft,
00182            nkeys) ;
00183 }

KvpErrorCode kvpError ( void   ) 

Definition at line 1460 of file keyValuePair.c.

References lastError.

Referenced by KeyRing::error(), KeyRing::errorString(), and main().

01461 {
01462    return (lastError) ;
01463 }

const char* kvpErrorString ( KvpErrorCode  code  ) 

Definition at line 1395 of file keyValuePair.c.

References KVP_E_BADINPUT, KVP_E_BADKEY, KVP_E_BADTYPE, KVP_E_BADVALUE, KVP_E_DUPLICATE, KVP_E_ILLNUMBER, KVP_E_NOTFOUND, KVP_E_OK, KVP_E_SYSTEM, KVP_E_TERMINATOR, KVP_E_TOOLONG, KVP_E_TOOMANY, KVP_E_TRUNCATE, and KVP_E_WRONGCOUNT.

Referenced by KeyRing::errorString(), and kvpPrintError().

01398 {
01399    const char* result ;
01400 
01401    switch (code) {
01402    case KVP_E_OK:
01403       result = "Success" ;
01404       break ;
01405    case KVP_E_DUPLICATE:
01406       result = "Duplicate key" ;
01407       break ;
01408    case KVP_E_NOTFOUND:
01409       result = "Key not found" ;
01410       break ;
01411    case KVP_E_SYSTEM:
01412       result = "error from system function:" ;
01413       break ;
01414    case KVP_E_BADTYPE:
01415       result = "Type not supported" ;
01416       break ;
01417    case KVP_E_BADKEY:
01418       result = "Illegal characters in key" ;
01419       break ;
01420    case KVP_E_BADVALUE:
01421       result = "value not valid in requested type" ;
01422       break ;
01423    case KVP_E_TOOMANY:
01424       result = "Maximum number of keys exceeded" ;
01425       break ;
01426    case KVP_E_TOOLONG:
01427       result = "record too long to parse" ;
01428       break ;
01429    case KVP_E_BADINPUT:
01430       result = "Syntax error in input" ;
01431       break ;
01432    case KVP_E_TRUNCATE:
01433       result = "Array truncated" ;
01434       break ;
01435    case KVP_E_WRONGCOUNT:
01436       result = "inconsistent element count" ;
01437       break ;
01438    case KVP_E_ILLNUMBER:
01439       result = "illegal character in number" ;
01440       break ;
01441    case KVP_E_TERMINATOR:
01442       result = "missing terminator on input string" ;
01443       break ;
01444    default:
01445       result = "unknown error" ;
01446    }
01447    return (result) ;
01448 }

int kvpFormat ( char *  buffer,
int  length 
)

Definition at line 1327 of file keyValuePair.c.

References keyPtrs, KT_FLOAT, KT_INT, KT_INVALID, KT_STRING, nelements, nkeys, valPtrs, and valTypes.

Referenced by kvpWrite().

01331 {
01332    int entry ;
01333    int offset ;
01334    int nchars ;
01335    const char* type ;
01336 
01337    offset = 0 ;
01338    for (entry = 0 ; entry < nkeys ; entry++) {
01339       switch (valTypes[entry]) {
01340       case KT_INVALID:
01341          /* skip it */
01342          continue;
01343       case KT_INT:
01344          type = "I" ;
01345          break ;
01346       case KT_FLOAT:
01347          type = "F" ;
01348          break ;
01349       case KT_STRING:
01350       default:
01351          type = "S" ;
01352       }
01353 
01354       nchars = snprintf (&buffer[offset], bufferSize-offset,
01355                          "%s#%s%d=%s;",
01356                          keyPtrs[entry], type, nelements[entry],
01357                          valPtrs[entry]) ;
01358 
01359       if ((nchars > bufferSize-offset) || (nchars == -1)) {
01360          return (-1) ;
01361       }
01362       offset += nchars ;
01363    }
01364    return (offset) ;
01365 }

int kvpGetDec ( const char *  key,
int  defaultValue 
)

Definition at line 997 of file keyValuePair.c.

References kvpGetBase().

Referenced by main().

01001 {
01002    return (kvpGetBase (key, defaultValue, 10)) ;
01003 }

double kvpGetDouble ( const char *  key,
double  defaultValue 
)

Definition at line 1139 of file keyValuePair.c.

References KVP_E_BADVALUE, KVP_E_NOTFOUND, KVP_E_OK, kvpGetString(), and lastError.

Referenced by kvpGetFloat(), and main().

01143 {
01144    double value ;
01145    double kValue ;
01146    char* valString ;
01147    char* endPtr ;
01148 
01149    value = defaultValue ;
01150 
01151    valString = kvpGetString (key) ;
01152    if (valString != NULL) {
01153       kValue = strtod (valString, &endPtr) ;
01154       if (valString != endPtr) {
01155          value = kValue ;
01156          lastError = KVP_E_OK ;
01157       }
01158       else {
01159          lastError = KVP_E_BADVALUE ;
01160       }
01161    }
01162    else {
01163       lastError = KVP_E_NOTFOUND ;
01164    }
01165    return (value) ;
01166 }

KvpErrorCode kvpGetEntry ( int  entry,
char **  key,
KeyType type,
int *  size,
char **  value 
)

Definition at line 860 of file keyValuePair.c.

References keyPtrs, KVP_E_NOTFOUND, KVP_E_OK, nelements, nkeys, valPtrs, and valTypes.

Referenced by KeyRing::KeyRing().

00867 {
00868    if (entry < nkeys) {
00869      *key = keyPtrs[entry] ;
00870      *type = valTypes[entry] ;
00871      *value = valPtrs[entry] ;
00872      *size = nelements[entry] ;
00873      return (KVP_E_OK) ;
00874    }
00875    else {
00876      return (KVP_E_NOTFOUND) ;
00877    }
00878 }

float kvpGetFloat ( const char *  key,
float  defaultValue 
)

Definition at line 1178 of file keyValuePair.c.

References kvpGetDouble().

Referenced by KeyRing::KeyRing(), and main().

01182 {
01183    return ((float) kvpGetDouble (key, (double) defaultValue)) ;
01184 }

KvpErrorCode kvpGetFloatArray ( const char *  key,
float *  values,
int *  entries 
)

Definition at line 1087 of file keyValuePair.c.

References KT_FLOAT, KVP_E_BADVALUE, KVP_E_NOTFOUND, KVP_E_OK, KVP_E_TRUNCATE, kvpFindKey(), lastError, nelements, valPtrs, and valTypes.

Referenced by main().

01092 {
01093    char* valString ;
01094    char* endPtr ;
01095    int index ;
01096    int element ;
01097 
01098    lastError = KVP_E_OK ;
01099    index = kvpFindKey (key) ;
01100    if (index >= 0) {
01101       if (valTypes[index] == KT_FLOAT) {
01102          valString = valPtrs[index] ;
01103 
01104          if (nelements[index] <= *entries) {
01105             *entries = nelements[index] ;
01106          }
01107          else {
01108             lastError = KVP_E_TRUNCATE ;
01109          }
01110          for (element = 0 ; element < *entries ; element++) {
01111             values[element] = strtod (valString, &endPtr) ;
01112             if (valString == endPtr) {
01113                lastError = KVP_E_BADVALUE ;
01114                lastError = KVP_E_BADVALUE ;
01115                break ;
01116             }
01117             valString = endPtr + 1 ;
01118          }
01119       }
01120       else {
01121          lastError = KVP_E_BADVALUE ;
01122       }
01123    }
01124    else {
01125       lastError = KVP_E_NOTFOUND ;
01126    }
01127    return (lastError) ;
01128 }

int kvpGetHex ( const char *  key,
int  defaultValue 
)

Definition at line 980 of file keyValuePair.c.

References kvpGetBase().

Referenced by main().

00984 {
00985    return (kvpGetBase (key, defaultValue, 16)) ;
00986 }

int kvpGetInt ( const char *  key,
int  defaultValue 
)

Definition at line 1016 of file keyValuePair.c.

References kvpGetBase().

Referenced by main().

01020 {
01021    return (kvpGetBase (key, defaultValue, 0)) ;
01022 }

KvpErrorCode kvpGetIntArray ( const char *  key,
int *  values,
int *  entries 
)

Definition at line 1034 of file keyValuePair.c.

References KT_INT, KVP_E_BADVALUE, KVP_E_NOTFOUND, KVP_E_OK, KVP_E_TRUNCATE, kvpFindKey(), lastError, nelements, valPtrs, and valTypes.

Referenced by KeyRing::KeyRing(), and main().

01039 {
01040    char* valString ;
01041    char* endPtr ;
01042    int index ;
01043    int element ;
01044 
01045    lastError = KVP_E_OK ;
01046    index = kvpFindKey (key) ;
01047    if (index >= 0) {
01048       if (valTypes[index] == KT_INT) {
01049          valString = valPtrs[index] ;
01050 
01051          if (nelements[index] <= *entries) {
01052             *entries = nelements[index] ;
01053          }
01054          else {
01055             lastError = KVP_E_TRUNCATE ;
01056          }
01057          for (element = 0 ; element < *entries ; element++) {
01058             values[element] = strtol (valString, &endPtr, 0) ;
01059             if (valString == endPtr) {
01060                lastError = KVP_E_BADVALUE ;
01061                lastError = KVP_E_BADVALUE ;
01062                break ;
01063             }
01064             valString = endPtr + 1 ;
01065          }
01066       }
01067       else {
01068          lastError = KVP_E_BADVALUE ;
01069       }
01070    }
01071    else {
01072       lastError = KVP_E_NOTFOUND ;
01073    }
01074    return (lastError) ;
01075 }

char* kvpGetString ( const char *  key  ) 

Definition at line 889 of file keyValuePair.c.

References KVP_E_NOTFOUND, KVP_E_OK, kvpFindKey(), lastError, and valPtrs.

Referenced by kvpGetBase(), kvpGetDouble(), and main().

00892 {
00893    int keynum ;
00894 
00895    keynum = kvpFindKey (key) ;
00896    if (keynum >= 0) {
00897      lastError = KVP_E_OK ;
00898      return (valPtrs[keynum]) ;
00899    }
00900    else {
00901      lastError = KVP_E_NOTFOUND ;
00902      return (NULL) ;
00903    }
00904 }

KvpErrorCode kvpGetStringArray ( const char *  key,
char *  values,
int  maxlen,
int *  entries 
)

Definition at line 915 of file keyValuePair.c.

References KT_STRING, KVP_E_NOTFOUND, KVP_E_OK, KVP_E_TRUNCATE, kvpFindKey(), lastError, valPtrs, and valTypes.

Referenced by main().

00921 {
00922    char* valString ;
00923    int index ;
00924    int element ;
00925    int length ;
00926    int end ;
00927 
00928    lastError = KVP_E_OK ;
00929    index = kvpFindKey (key) ;
00930    if (index >= 0) {
00931       if (valTypes[index] == KT_STRING) {
00932          valString = valPtrs[index] ;
00933       }
00934       element = 0 ;
00935       length = 0 ;
00936       lastError = KVP_E_OK ;
00937       end = 0 ;
00938 
00939       do {
00940          if (*valString == 0) {
00941             end = 1 ;
00942          }
00943 
00944          if (*valString == ',') {
00945             values[element*maxlen+length] = 0 ;
00946             element++ ;
00947             length = 0 ;
00948             if (element == *entries) {
00949                lastError = KVP_E_TRUNCATE ;
00950             }
00951          }
00952          else {
00953             values[element*maxlen+length] = *valString ;
00954             length++ ;
00955             if (length == maxlen) {
00956                lastError = KVP_E_TRUNCATE ;
00957             }
00958          }
00959          valString++ ;
00960       } while (!end  && (lastError == KVP_E_OK)) ;
00961 
00962 
00963       *entries = element + 1 ;
00964    }
00965    else {
00966       lastError = KVP_E_NOTFOUND ;
00967    }
00968    return (lastError) ;
00969 }

void kvpInit ( int  bufferSize  ) 

Definition at line 820 of file keyValuePair.c.

References KVP_MIN_BUFFER_SIZE, kvpBuffer, kvpBufferSize, spaceLeft, and spare.

Referenced by kvpParse(), and kvpSet().

00823 {
00824    if (bufferSize > KVP_MIN_BUFFER_SIZE) {
00825       kvpBufferSize = bufferSize ;
00826    }
00827    else {
00828       kvpBufferSize = KVP_MIN_BUFFER_SIZE ;
00829    }
00830 
00831    kvpBuffer = malloc(kvpBufferSize) ;
00832    spare = kvpBuffer ;
00833    spaceLeft = kvpBufferSize ;
00834 }

int kvpParse ( const char *  record  ) 

Definition at line 674 of file keyValuePair.c.

References count, keyPtrs, KT_FLOAT, KT_INT, KT_INVALID, KT_STRING, KVP_E_BADINPUT, KVP_E_OK, KVP_E_TERMINATOR, KVP_E_TOOMANY, KVP_E_WRONGCOUNT, kvpFindKey(), kvpInit(), kvpRealloc(), lastError, MAXKEYS, nelements, nkeys, spaceLeft, spare, stripSpaces(), validateValue(), valPtrs, and valTypes.

Referenced by KeyRing::KeyRing(), and main().

00677 {
00678    char* myPtr ;
00679    char* key ;
00680    char* value ;
00681    char typeChar ;
00682    int count ;
00683    int reclen ;
00684    int oldKeyNumber ;
00685 
00686    /* Make sure things have been initialised properly */
00687    reclen = strlen (record) + 1 ;
00688 
00689    if (spare == NULL) {
00690       kvpInit (reclen) ;
00691    }
00692 
00693    if (reclen > spaceLeft) {
00694       kvpRealloc (reclen) ;
00695    }
00696    
00697    /* Take a local copy of the input record */
00698    strncpy (spare, record, reclen) ;
00699 
00700    myPtr = spare;
00701    while (isspace(*myPtr)) {
00702       myPtr++ ;
00703    }
00704 
00705    /* Find the Key Value pairs in our copy and remember where they are */
00706    do {
00707       key = myPtr ;
00708       myPtr = strchr (myPtr, '#') ;
00709       /* Simplistic test if there isn't a hash sign there isn't
00710          another key/value pair. */
00711       if (myPtr != NULL) {
00712          if (nkeys >= MAXKEYS) {
00713             lastError = KVP_E_TOOMANY ;
00714             return (-1) ;
00715          }
00716          /* terminate key string excluding # */
00717          *myPtr++ = 0 ;
00718          /* Save key without surrounding whitespace */
00719          key = stripSpaces (key) ;
00720          /* Ignore comments introduced by // */
00721          if ((key[0] == '/') && (key[1] == '/')) {
00722             myPtr = NULL ;
00723             break ;
00724          }
00725          keyPtrs[nkeys] = key ;
00726 
00727          /* Invalidate old entry for this key if we have one */
00728          oldKeyNumber = kvpFindKey (key) ;
00729          if (oldKeyNumber >= 0) {
00730             valTypes[oldKeyNumber] = KT_INVALID ;
00731          }
00732 
00733          /* extract type info */
00734          typeChar = *myPtr++ ;
00735          switch (typeChar) {
00736          case 'I':
00737             valTypes[nkeys] = KT_INT ;
00738             break ;
00739          case 'F':
00740             valTypes[nkeys] = KT_FLOAT ;
00741             break ;
00742          case 'S':
00743             valTypes[nkeys] = KT_STRING ;
00744             break ;
00745          }
00746 
00747          /* Check for specification of number of elements */
00748          if (*myPtr == '=') {
00749             nelements[nkeys] = 0 ;
00750          }
00751          else {
00752             /* Read array length from folowing chars */
00753             nelements[nkeys] = strtol (myPtr, &myPtr, 10) ;
00754          }
00755 
00756          /* Save the value */
00757          if (*myPtr == '=') {
00758             myPtr++ ;
00759             value = myPtr ;
00760             /* The value ends at the next semicolon */
00761             myPtr = strchr (myPtr, ';') ;
00762             if (myPtr == NULL) {
00763                lastError = KVP_E_TERMINATOR ;
00764                reclen++ ;
00765             }
00766             else {
00767                /* strip the semicolon */
00768                *myPtr++ = 0 ;
00769             }
00770             valPtrs[nkeys] = value ;
00771 
00772             /* Count the number of elements in the value and check
00773                validity of numbers */
00774             count = validateValue (value, valTypes[nkeys]) ;
00775             if (count < 0) {
00776                return (count) ;
00777             }
00778             if (nelements[nkeys] == 0) {
00779                nelements[nkeys] = count ;
00780             }
00781             else if (nelements[nkeys] != count) {
00782                lastError = KVP_E_WRONGCOUNT ;
00783                return (-1) ;
00784             }
00785             nkeys++ ;
00786          }
00787          else {
00788             lastError = KVP_E_BADINPUT ;
00789             return (-1) ;
00790          }
00791       }
00792    } while (myPtr != NULL) ;
00793 
00794    spare += reclen ;
00795    spaceLeft -= reclen ;
00796 
00797    lastError = KVP_E_OK ;
00798    return (nkeys) ;
00799 }

void kvpPrintError ( KvpErrorCode  code  ) 

Definition at line 1377 of file keyValuePair.c.

References kvpErrorString().

Referenced by main().

01380 {
01381    fprintf (stderr, "kvp error -- %s\n", kvpErrorString (code)) ;
01382 }

int kvpQueryLength ( const char *  key  ) 

Definition at line 836 of file keyValuePair.c.

References KVP_E_NOTFOUND, KVP_E_OK, kvpFindKey(), lastError, and nelements.

Referenced by main().

00836                                      {
00837    int keynum ;
00838 
00839    keynum = kvpFindKey (key) ;
00840    if (keynum >= 0) {
00841      lastError = KVP_E_OK ;
00842      return (nelements[keynum]) ;
00843    }
00844    else {
00845      lastError = KVP_E_NOTFOUND ;
00846      return (0) ;
00847    }
00848 }

void kvpReset ( void   ) 

Definition at line 810 of file keyValuePair.c.

References kvpBuffer, nkeys, spaceLeft, and spare.

Referenced by KeyRing::write().

00811 {
00812    if (kvpBuffer != NULL) {
00813       free (kvpBuffer) ;
00814    }
00815    spare = kvpBuffer = NULL ;
00816    spaceLeft = 0 ;
00817    nkeys = 0 ;
00818 }

KvpErrorCode kvpSetFloat ( const char *  key,
float  value 
)

Definition at line 1284 of file keyValuePair.c.

References KT_FLOAT, and kvpSet().

Referenced by main().

01288 {
01289    return (kvpSet (key, &value, KT_FLOAT, 1)) ;
01290 }

KvpErrorCode kvpSetFloatArray ( const char *  key,
const float *  values,
int  count 
)

Definition at line 1231 of file keyValuePair.c.

References KT_FLOAT, and kvpSet().

Referenced by main(), and KeyRing::write().

01236 {
01237    return (kvpSet (key, values, KT_FLOAT, count)) ;
01238 }

KvpErrorCode kvpSetInt ( const char *  key,
int  value 
)

Definition at line 1249 of file keyValuePair.c.

References KT_INT, and kvpSet().

Referenced by main().

01253 {
01254    return (kvpSet (key, &value, KT_INT, 1)) ;
01255 }

KvpErrorCode kvpSetIntArray ( const char *  key,
const int *  values,
int  count 
)

Definition at line 1214 of file keyValuePair.c.

References KT_INT, and kvpSet().

Referenced by main(), and KeyRing::write().

01219 {
01220    return (kvpSet (key, values, KT_INT, count)) ;
01221 }

KvpErrorCode kvpSetString ( const char *  key,
const char *  value 
)

Definition at line 1197 of file keyValuePair.c.

References KT_STRING, and kvpSet().

Referenced by main(), and KeyRing::write().

01201 {
01202    return (kvpSet (key, value, KT_STRING, 1)) ;
01203 }

KvpErrorCode kvpUpdateInt ( const char *  key,
int  value 
)

Definition at line 1266 of file keyValuePair.c.

References KT_INT, and kvpUpdate().

01270 {
01271    return (kvpUpdate (key, &value, KT_INT, 1)) ;
01272 }

int kvpWrite ( int  stream  ) 

Definition at line 1301 of file keyValuePair.c.

References kvpBufferSize, and kvpFormat().

Referenced by main(), and KeyRing::write().

01304 {
01305    char* buffer ;
01306    int reclen ;
01307    int lengthWritten ;
01308 
01309    buffer = malloc (kvpBufferSize) ;
01310    reclen = kvpFormat (buffer, kvpBufferSize) + 1 ;
01311    lengthWritten = write (stream, buffer, reclen)  ;
01312    free (buffer) ;
01313    return (lengthWritten) ;
01314 }


Generated on 2 Nov 2017 for loon by  doxygen 1.6.1