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

« back to all changes in this revision

Viewing changes to lib9/fmt/dorfmt.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-08-20 17:34:06 UTC
  • mfrom: (6.2.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090820173406-xpwqa9ruyevvc0ut
Tags: 1:3-3
* Updating maintainer field.
* Updating vcs fields.
* Updating package to standards version 3.8.3.
* Updatin variables writing in rules to consistent style.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * The authors of this software are Rob Pike and Ken Thompson.
3
 
 *              Copyright (c) 2002 by Lucent Technologies.
4
 
 * Permission to use, copy, modify, and distribute this software for any
5
 
 * purpose without fee is hereby granted, provided that this entire notice
6
 
 * is included in all copies of any software which is or includes a copy
7
 
 * or modification of this software and in all copies of the supporting
8
 
 * documentation for such software.
9
 
 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
10
 
 * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE
11
 
 * ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
12
 
 * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
13
 
 */
 
1
/* Copyright (c) 2002-2006 Lucent Technologies; see LICENSE */
14
2
#include <stdarg.h>
15
3
#include <string.h>
16
4
#include "plan9.h"
19
7
 
20
8
/* format the output into f->to and return the number of characters fmted  */
21
9
 
 
10
/* BUG: THIS FILE IS NOT UPDATED TO THE  NEW SPEC */
22
11
int
23
12
dorfmt(Fmt *f, const Rune *fmt)
24
13
{
30
19
        nfmt = f->nfmt;
31
20
        for(;;){
32
21
                if(f->runes){
33
 
                        rt = f->to;
34
 
                        rs = f->stop;
 
22
                        rt = (Rune*)f->to;
 
23
                        rs = (Rune*)f->stop;
35
24
                        while((r = *fmt++) && r != '%'){
36
25
                                FMTRCHAR(f, rt, rs, r);
37
26
                        }
41
30
                                return f->nfmt - nfmt;
42
31
                        f->stop = rs;
43
32
                }else{
44
 
                        t = f->to;
45
 
                        s = f->stop;
 
33
                        t = (char*)f->to;
 
34
                        s = (char*)f->stop;
46
35
                        while((r = *fmt++) && r != '%'){
47
36
                                FMTRUNE(f, t, f->stop, r);
48
37
                        }
53
42
                        f->stop = s;
54
43
                }
55
44
 
56
 
                fmt = __fmtdispatch(f, (Rune*)fmt, 1);
 
45
                fmt = (Rune*)__fmtdispatch(f, (Rune*)fmt, 1);
57
46
                if(fmt == nil)
58
47
                        return -1;
59
48
        }