~ubuntu-branches/ubuntu/lucid/9base/lucid

« back to all changes in this revision

Viewing changes to lib9/strecpy.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2006-01-25 15:33:00 UTC
  • Revision ID: james.westby@ubuntu.com-20060125153300-6hh4p9wx8iqqply5
Tags: upstream-2
ImportĀ upstreamĀ versionĀ 2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <lib9.h>
 
2
 
 
3
char*
 
4
strecpy(char *to, char *e, char *from)
 
5
{
 
6
        if(to >= e)
 
7
                return to;
 
8
        to = memccpy(to, from, '\0', e - to);
 
9
        if(to == nil){
 
10
                to = e - 1;
 
11
                *to = '\0';
 
12
        }else{
 
13
                to--;
 
14
        }
 
15
        return to;
 
16
}