~ubuntu-branches/ubuntu/precise/psicode/precise

« back to all changes in this revision

Viewing changes to src/lib/libchkpt/override_occ.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck
  • Date: 2008-06-07 16:49:57 UTC
  • mfrom: (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080607164957-8pifvb133yjlkagn
Tags: 3.3.0-3
* debian/rules (DEB_MAKE_CHECK_TARGET): Do not abort test suite on
  failures.
* debian/rules (DEB_CONFIGURE_EXTRA_FLAGS): Set ${bindir} to /usr/lib/psi.
* debian/rules (install/psi3): Move psi3 file to /usr/bin.
* debian/patches/07_464867_move_executables.dpatch: New patch, add
  /usr/lib/psi to the $PATH, so that the moved executables are found.
  (closes: #464867)
* debian/patches/00list: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*!
 
2
  \file override_occ.c
 
3
  \ingroup (CHKPT)
 
4
*/
 
5
 
 
6
#include <stdlib.h>
 
7
#include "chkpt.h"
 
8
#include <libpsio/psio.h>
 
9
#include <psifiles.h>
 
10
 
 
11
/*!
 
12
** chkpt_rd_override_occ(): Reads flag which tells cscf to ignore docc/socc
 
13
** vectors and use occupations in chkpt file instead
 
14
**  
 
15
** takes no arguments.
 
16
**  
 
17
** returns: 1 if chkpt occupations should be forced; 0 otherwise
 
18
**        
 
19
** \ingroup (CHKPT)
 
20
*/
 
21
 
 
22
int chkpt_rd_override_occ(void)
 
23
{
 
24
  int override=0, i, keylen;
 
25
  char *keyword;
 
26
  /*
 
27
  keyword = chkpt_build_keyword("Override Occupations");
 
28
  if ( chkpt_exist(keyword) )
 
29
    psio_read_entry(PSIF_CHKPT, keyword, (char *) &override, sizeof(int));
 
30
  free(keyword);
 
31
  return override;
 
32
  */
 
33
 
 
34
  /* new way - keep override in root area always */
 
35
  keylen = 22;
 
36
  keyword = (char *) malloc((keylen+1)*sizeof(char));
 
37
  sprintf(keyword, "::%s", "Override Occupations");
 
38
  keyword[keylen] = '\0';
 
39
 
 
40
  if ( chkpt_exist(keyword) )
 
41
    psio_read_entry(PSIF_CHKPT, keyword, (char *) &override, sizeof(int));
 
42
 
 
43
  free(keyword);
 
44
  return override;
 
45
}
 
46
 
 
47
/*!
 
48
** chkpt_wt_override_occ(): Writes flag which tells cscf to ignore docc/socc
 
49
** vectors and use occupations in chkpt file instead
 
50
**  
 
51
** arguments: (int) 1 to set override; 0 otherwise
 
52
**  
 
53
** returns: none
 
54
**        
 
55
** \ingroup (CHKPT)
 
56
*/
 
57
 
 
58
void chkpt_wt_override_occ(int override)
 
59
{
 
60
  char *keyword;
 
61
  int keylen;
 
62
  /*
 
63
  keyword = chkpt_build_keyword("Override Occupations");
 
64
  psio_write_entry(PSIF_CHKPT, keyword, (char *) &override, sizeof(int));
 
65
  */
 
66
 
 
67
  /* new way - keep override in root area always */
 
68
  keylen = 22;
 
69
  keyword = (char *) malloc((keylen+1)*sizeof(char));
 
70
  sprintf(keyword, "::%s", "Override Occupations");
 
71
  keyword[keylen] = '\0';
 
72
 
 
73
  psio_write_entry(PSIF_CHKPT, keyword, (char *) &override, sizeof(int));
 
74
 
 
75
  free(keyword);
 
76
  return;
 
77
}