imapext-2007
diff src/osdep/wce/nl_wce.c @ 0:ada5e610ab86
imap-2007e
author | yuuji@gentei.org |
---|---|
date | Mon, 14 Sep 2009 15:17:45 +0900 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/osdep/wce/nl_wce.c Mon Sep 14 15:17:45 2009 +0900 1.3 @@ -0,0 +1,61 @@ 1.4 +/* ======================================================================== 1.5 + * Copyright 1988-2006 University of Washington 1.6 + * 1.7 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.8 + * you may not use this file except in compliance with the License. 1.9 + * You may obtain a copy of the License at 1.10 + * 1.11 + * http://www.apache.org/licenses/LICENSE-2.0 1.12 + * 1.13 + * 1.14 + * ======================================================================== 1.15 + */ 1.16 + 1.17 +/* 1.18 + * Program: Windows/TOPS-20 newline routines 1.19 + * 1.20 + * Author: Mark Crispin 1.21 + * Networks and Distributed Computing 1.22 + * Computing & Communications 1.23 + * University of Washington 1.24 + * Administration Building, AG-44 1.25 + * Seattle, WA 98195 1.26 + * Internet: MRC@CAC.Washington.EDU 1.27 + * 1.28 + * Date: 1 August 1988 1.29 + * Last Edited: 30 August 2006 1.30 + */ 1.31 + 1.32 +/* Copy string with CRLF newlines 1.33 + * Accepts: destination string 1.34 + * pointer to size of destination string buffer 1.35 + * source string 1.36 + * length of source string 1.37 + * Returns: length of copied string 1.38 + */ 1.39 + 1.40 +unsigned long strcrlfcpy (unsigned char **dst,unsigned long *dstl, 1.41 + unsigned char *src,unsigned long srcl) 1.42 +{ 1.43 + /* flush destination buffer if too small */ 1.44 + if (*dst && (srcl > *dstl)) fs_give ((void **) dst); 1.45 + if (!*dst) { /* make a new buffer if needed */ 1.46 + *dst = (char *) fs_get ((size_t) (*dstl = srcl) + 1); 1.47 + if (dstl) *dstl = srcl; /* return new buffer length to main program */ 1.48 + } 1.49 + /* copy strings */ 1.50 + if (srcl) memcpy (*dst,src,(size_t) srcl); 1.51 + *(*dst + srcl) = '\0'; /* tie off destination */ 1.52 + return srcl; /* return length */ 1.53 +} 1.54 + 1.55 + 1.56 +/* Length of string after strcrlfcpy applied 1.57 + * Accepts: source string 1.58 + * Returns: length of string 1.59 + */ 1.60 + 1.61 +unsigned long strcrlflen (STRING *s) 1.62 +{ 1.63 + return SIZE (s); /* no-brainer on DOS! */ 1.64 +}