~ubuntu-branches/debian/wheezy/nano/wheezy

« back to all changes in this revision

Viewing changes to src/utils.c

Tags: upstream-1.3.11
ImportĀ upstreamĀ versionĀ 1.3.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: utils.c,v 1.110 2005/12/23 03:15:12 dolorous Exp $ */
 
1
/* $Id: utils.c,v 1.112 2006/01/09 03:23:29 dolorous Exp $ */
2
2
/**************************************************************************
3
3
 *   utils.c                                                              *
4
4
 *                                                                        *
5
5
 *   Copyright (C) 1999-2004 Chris Allegretta                             *
6
 
 *   Copyright (C) 2005 David Lawrence Ramsey                             *
 
6
 *   Copyright (C) 2005-2006 David Lawrence Ramsey                        *
7
7
 *   This program is free software; you can redistribute it and/or modify *
8
8
 *   it under the terms of the GNU General Public License as published by *
9
9
 *   the Free Software Foundation; either version 2, or (at your option)  *
81
81
    return TRUE;
82
82
}
83
83
 
84
 
/* Read an int and a ssize_t, separated by a comma, from str, and store
85
 
 * them in *line and *column (if they're not both NULL).  On error, we
86
 
 * return FALSE.  Otherwise, we return TRUE. */
 
84
/* Read two ssize_t's, separated by a comma, from str, and store them in
 
85
 * *line and *column (if they're not both NULL).  Return FALSE on error,
 
86
 * or TRUE otherwise. */
87
87
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
88
88
{
89
89
    bool retval = TRUE;
197
197
    int c;
198
198
 
199
199
    /* Sanity checks. */
200
 
    assert(lineptr != NULL && n != NULL && stream != NULL);
 
200
    if (lineptr == NULL || n == NULL || stream == NULL) {
 
201
        errno = EINVAL;
 
202
        return -1;
 
203
    }
201
204
 
202
205
    /* Allocate the line the first time. */
203
206
    if (*lineptr == NULL) {