--- np2/common/profile.c 2003/10/16 17:57:10 1.1 +++ np2/common/profile.c 2004/02/21 04:48:35 1.4 @@ -103,3 +103,43 @@ gden_err0: return(r); } + +// ---- + +const char *profile_getarg(const char *str, char *buf, UINT leng) { + + UINT8 c; + + if (leng) { + leng--; + } + else { + buf = NULL; + } + if (str) { + c = (UINT8)*str; + while(((c - 1) & 0xff) < 0x20) { + str++; + c = (UINT8)*str; + } + if (c == 0) { + str = NULL; + } + } + if (str) { + c = (UINT8)*str; + while(c > 0x20) { + if (leng) { + *buf++ = c; + leng--; + } + str++; + c = (UINT8)*str; + } + } + if (buf) { + buf[0] = '\0'; + } + return(str); +} +