~ubuntu-branches/ubuntu/wily/grass/wily

« back to all changes in this revision

Viewing changes to lib/init/chk_dbase.c

Tags: 7.0.0~rc1+ds1-1~exp1
* New upstream release candidate.
* Repack upstream tarball, remove precompiled Python objects.
* Add upstream metadata.
* Update gbp.conf and Vcs-Git URL to use the experimental branch.
* Update watch file for GRASS 7.0.
* Drop build dependencies for Tcl/Tk, add build dependencies:
  python-numpy, libnetcdf-dev, netcdf-bin, libblas-dev, liblapack-dev
* Update Vcs-Browser URL to use cgit instead of gitweb.
* Update paths to use grass70.
* Add configure options: --with-netcdf, --with-blas, --with-lapack,
  remove --with-tcltk-includes.
* Update patches for GRASS 7.
* Update copyright file, changes:
  - Update copyright years
  - Group files by license
  - Remove unused license sections
* Add patches for various typos.
* Fix desktop file with patch instead of d/rules.
* Use minimal dh rules.
* Bump Standards-Version to 3.9.6, no changes.
* Use dpkg-maintscript-helper to replace directories with symlinks.
  (closes: #776349)
* Update my email to use @debian.org address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <stdio.h>
2
 
#include <sys/types.h>
3
 
#include <unistd.h>
4
 
#include <sys/stat.h>
5
 
#ifndef __MINGW32__
6
 
#  include <pwd.h>
7
 
#endif
8
 
 
9
 
int can_make_location(char *gisdbase, char *location)
10
 
{
11
 
    struct stat s;
12
 
    struct passwd *pwd;
13
 
 
14
 
    /* make sure this is a directory */
15
 
    if (stat(gisdbase, &s) != 0) {
16
 
        fprintf(stderr, "\n** %s not found **\n", gisdbase);
17
 
        return 0;
18
 
    }
19
 
    if (!(s.st_mode & S_IFDIR)) {
20
 
        fprintf(stderr, "\n** %s is not a directory **\n", gisdbase);
21
 
        return 0;
22
 
    }
23
 
 
24
 
    /* look for write permission */
25
 
    if (access(gisdbase, 2) == 0)
26
 
        return 1;
27
 
 
28
 
    fprintf(stderr, "\nNote\n");
29
 
    fprintf(stderr,
30
 
            " You don't have permission under %s to create a new location\n",
31
 
            gisdbase);
32
 
#ifndef __MINGW32__
33
 
    if ((pwd = getpwuid(s.st_uid)))
34
 
        fprintf(stderr, " See user %s about creating location %s\n",
35
 
                pwd->pw_name, location);
36
 
#endif
37
 
    return 0;
38
 
}