~ubuntu-branches/debian/lenny/cracklib2/lenny

« back to all changes in this revision

Viewing changes to cracklib/stringlib.c

  • Committer: Bazaar Package Importer
  • Author(s): Jan Dittberner, Steve Langasek, Jan Dittberner
  • Date: 2008-10-16 21:04:24 UTC
  • mfrom: (4.1.2 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081016210424-bp06uo8c6xkjabzi
Tags: 2.8.12-8lenny1
[ Steve Langasek ]
* debian/update-cracklib: don't rely on [ -nt ] to return true when
  the second file is non-existent, since this fails under dash.
  LP: #278743.

[ Jan Dittberner ]
* integrate Ubuntu bugfix
* use set -e in debian/cracklib-runtime.preinst to fix lintian warning
  maintainer-script-ignores-errors

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * This program is copyright Alec Muffett 1993. The author disclaims all 
3
 
 * responsibility or liability with respect to it's usage or its effect 
4
 
 * upon hardware or computer systems, and maintains copyright as set out 
5
 
 * in the "LICENCE" document which accompanies distributions of Crack v4.0 
6
 
 * and upwards.
7
 
 */
8
 
 
9
 
#include "packer.h"
10
 
 
11
 
static char vers_id[] = "stringlib.c : v2.3p2 Alec Muffett 18 May 1993";
12
 
 
13
 
char
14
 
Chop(string)
15
 
    register char *string;
16
 
{
17
 
    register char c;
18
 
    register char *ptr;
19
 
    c = '\0';
20
 
 
21
 
    for (ptr = string; *ptr; ptr++);
22
 
    if (ptr != string)
23
 
    {
24
 
        c = *(--ptr);
25
 
        *ptr = '\0';
26
 
    }
27
 
    return (c);
28
 
}
29
 
 
30
 
char *
31
 
Trim(string)
32
 
    register char *string;
33
 
{
34
 
    register char *ptr;
35
 
    for (ptr = string; *ptr; ptr++);
36
 
 
37
 
    while ((--ptr >= string) && isspace(*ptr));
38
 
 
39
 
    *(++ptr) = '\0';
40
 
 
41
 
    return (ptr);
42
 
}
43
 
 
44
 
char *
45
 
Clone(string)
46
 
    char *string;
47
 
{
48
 
    register char *retval;
49
 
    retval = (char *) malloc(strlen(string) + 1);
50
 
    if (retval)
51
 
    {
52
 
        strcpy(retval, string);
53
 
    }
54
 
    return (retval);
55
 
}