~ubuntu-branches/ubuntu/wily/sup/wily

« back to all changes in this revision

Viewing changes to nxtarg.c

  • Committer: Bazaar Package Importer
  • Author(s): Jochen Friedrich
  • Date: 2006-11-02 15:03:30 UTC
  • mfrom: (1.1.1 upstream) (3.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20061102150330-yt4yavw4rj1hz8yj
Tags: 20060803-2
Fix CFLAGS, so libwrap is built into sup again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*      $NetBSD: nxtarg.c,v 1.5 2002/07/10 20:19:41 wiz Exp $   */
 
2
 
1
3
/*
2
4
 * Copyright (c) 1991 Carnegie Mellon University
3
5
 * All Rights Reserved.
4
 
 * 
 
6
 *
5
7
 * Permission to use, copy, modify and distribute this software and its
6
8
 * documentation is hereby granted, provided that both the copyright
7
9
 * notice and this permission notice appear in all copies of the
52
54
 *
53
55
 *  Originally  from klg (Ken Greer); IUS/SUS UNIX.
54
56
 */
 
57
#include "supcdefs.h"
 
58
#include "supextern.h"
55
59
 
56
60
char _argbreak;
57
 
char *skipto();
58
61
 
59
 
char *nxtarg (q,brk)
60
 
char **q,*brk;
 
62
char *
 
63
nxtarg(char **q, char *brk)
61
64
{
62
 
        register char *front,*back;
63
 
        front = *q;                     /* start of string */
 
65
        char *front, *back;
 
66
        front = *q;             /* start of string */
64
67
        /* leading blanks and tabs */
65
 
        while (*front && (*front == ' ' || *front == '\t')) front++;
 
68
        while (*front && (*front == ' ' || *front == '\t'))
 
69
                front++;
66
70
        /* find break character at end */
67
 
        if (brk == 0)  brk = " ";
68
 
        back = skipto (front,brk);
 
71
        if (brk == 0)
 
72
                brk = " ";
 
73
        back = skipto(front, brk);
69
74
        _argbreak = *back;
70
 
        *q = (*back ? back+1 : back);   /* next arg start loc */
 
75
        *q = (*back ? back + 1 : back); /* next arg start loc */
71
76
        /* elim trailing blanks and tabs */
72
77
        back -= 1;
73
 
        while ((back >= front) && (*back == ' ' || *back == '\t')) back--;
 
78
        while ((back >= front) && (*back == ' ' || *back == '\t'))
 
79
                back--;
74
80
        back++;
75
 
        if (*back)  *back = '\0';
 
81
        if (*back)
 
82
                *back = '\0';
76
83
        return (front);
77
84
}