~ubuntu-branches/ubuntu/vivid/gzip/vivid

« back to all changes in this revision

Viewing changes to sample/sub.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-10-19 11:42:42 UTC
  • mfrom: (4.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20111019114242-d8wiiu8kbvdtgmgj
Tags: 1.4-1ubuntu1
* Merge with Debian testing.  Remaining Ubuntu changes:
  - debian/{control,rules}: Remove the Win32 build and mingw64
    build-dependency, since mingw is in universe, and will remain so for
    the forseeable future.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
      gunzip < double.data.sgz | add > double.data
34
34
*/
35
35
 
 
36
#include <config.h>
36
37
#include <stdio.h>
 
38
#include <stdlib.h>
37
39
 
38
40
#define MAGIC1    'S' /* sub data */
39
41
#define MAGIC2    26  /* ^Z */
54
56
  if (argc > 2)
55
57
  {
56
58
    fputs("sub: only one argument needed--# of differences\n", stderr);
57
 
    exit(1);
 
59
    exit(EXIT_FAILURE);
58
60
  }
59
61
  if (argc > 1)
60
62
    n = atoi(argv[1]);
62
64
  if (n < 0) n = -n;    /* tolerate "sub -2" */
63
65
  if (n == 0 || n > MAX_DIST) {
64
66
    fputs("sub: incorrect distance\n", stderr);
65
 
    exit(1);
 
67
    exit(EXIT_FAILURE);
66
68
  }
67
69
 
68
70
  /* initialize last byte */
83
85
    if (i == n)                         /* cycle on n differences */
84
86
      i = 0;
85
87
  }
86
 
  exit(0);
 
88
  exit(EXIT_SUCCESS);
87
89
  return 0; /* avoid warning */
88
90
}