summaryrefslogtreecommitdiffstats
path: root/doc/libslapt.3
blob: 27a06671d23b4211e74d74b6bf1fce6255971d9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
.TH libslapt 3
.SH NAME
libslapt \- slapt-get library
.SH SYNOPSIS
.nf
#define _GNU_SOURCE
#include <slapt.h>

/* initialize slapt_rc_config */
slapt_rc_config *slapt_init_config(void);
/* parse config file for sources, excludes, and working_dir*/
slapt_rc_config *config = slapt_read_rc_config("/etc/slapt-get/slapt-getrc");
/* get a list of installed packages */
slapt_vector_t *installed = slapt_get_installed_pkgs();
/* parse the package data, normally using config->working_dir */
FILE *data_f = fopen("/var/cache/slapt-get/package_data","r");
slapt_vector_t *available = slapt_parse_packages_txt(data_f);

/* search for a package in a list via regex */
slapt_vector_t *results = slapt_search_pkg_list(installed,"[0-9]frg");
slapt_free_pkg_list(results);

/* look for a specific package */
slapt_pkg_info_t *pkg = slapt_get_exact_pkg(available,
                                            "slapt-get",
                                            "0.9.10c-i386-1");
if (!slapt_is_excluded(config,pkg)) {
  const char *error = slapt_download_pkg(config,pkg);

  if (error == NULL) {
    if (slapt_install_pkg(config,pkg) != 0) {
      fprintf(stderr,"error installing %s\\n"pkg->name);
    }
    if (slapt_upgrade_pkg(config,pkg) != 0) {
      fprintf(stderr,"error upgrading %s\\n"pkg->name);
    }
    if (slapt_remove_pkg(config,pkg) != 0) {
      fprintf(stderr,"error removing %s\\n"pkg->name);
    }
  }
}
slapt_free_pkg(pkg);

if (slapt_cmp_pkgs(pkg_a,pkg_b) = 0) {
  fprintf(stderr,"%s is equal to %s\\n",pkg_a->version,pkg_b->version);
} elsif (slapt_cmp_pkgs(pkg_a,pkg_b) < 0) {
  fprintf(stderr,"%s is less than %s\\n",pkg_a->version,pkg_b->version);
} elsif (slapt_cmp_pkgs(pkg_a,pkg_b) > 0) {
  fprintf(stderr,"%s is greater than %s\\n",pkg_a->version,pkg_b->version);
}

slapt_free_pkg_list(available);
slapt_free_pkg_list(installed);
slapt_free_rc_config(config);
.fi
.SH DESCRIPTION
This is a short overview on how to use libslapt with your C programs.  
.IP \fBCONFIGURATION\fP
.TP
slapt-get stores the configuration information in a \fIslapt_rc_config\fP object.  The configuration is parsed from the \fIslapt-getrc\fP which includes \fISOURCE\fP, \fIEXCLUDE\fP, and \fIWORKINGDIR\fP directives.  Various runtime configuration options are also stored within the \fIslapt_rc_config\fP object. 

.nf
  typedef struct {
    char working_dir[WORKINGDIR_TOKEN_LEN];
    slapt_vector_t *sources;
    slapt_vector_t *exclude_list;
    int (*progress_cb) (void *,double,double,double,double);
    bool download_only;
    bool dist_upgrade;
    bool simulate;
    bool no_prompt;
    bool re_install;
    bool ignore_excludes;
    bool no_md5_check;
    bool ignore_dep;
    bool disable_dep_check;
    bool print_uris;
    bool dl_stats;
    bool remove_obsolete;
    bool no_upgrade;
    uint32_t retry;
  } slapt_rc_config;
.fi

.TP
The \fIslapt_rc_config\fP is created with the \fIslapt_read_rc_config\fP() function by passing in the file location of the configuration to parse, or by calling \fIslapt_init_config\fP() to return an empty, initialized \fIslapt_rc_config\fP.
.sp
.B "slapt_rc_config *slapt_read_rc_config(const char *file_name);"
.sp
.B "slapt_rc_config *slapt_init_config(void);"
.sp
.TP
and is freed by a call to the \fIslapt_free_rc_config\fP() function.
.sp
.B "void slapt_free_rc_config(slapt_rc_config *global_config);"
.sp
.TP
The slapt-getrc configuration can be written back out with \fIslapt_write_rc_config\fP.
.sp
.B "int slapt_write_rc_config(const slapt_rc_config *global_config, const char *location);"
.sp
.TP
The progress callback is a function that is called while data is being downloaded.  It is in the format of \fBint slapt_progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);\fP
.sp
.TP
Package sources are represented by the \fIslapt_source_t\fP type.  They are created, destroyed, and interacted with using the following functions:
.sp
.nf
  typedef struct {
    char *url;
    SLAPT_PRIORITY_T priority;
    bool disabled;
  } slapt_source_t;
.sp
.B slapt_source_t *slapt_init_source(const char *s);
.B void slapt_free_source(slapt_source_t *src);
.fi
.sp
.TP
In order to initialize the slapt_rc_config->working_dir directory, \fIslapt_working_dir_init\fP() must be called.  It is a fatal error to call \fIslapt_working_dir_init\fP() with a directory that the current process does not have privileges to read, write, and execute.
.sp
.B "void slapt_working_dir_init(const slapt_rc_config *global_config);"
.sp
.IP \fBPACKAGES\fP
.TP
slapt-get stores packages within \fIslapt_pkg_info_t\fP objects.
.sp
.nf
  typedef struct {
    char md5[SLAPT_MD5_STR_LEN];
    char *name;
    char *version;
    char *mirror;
    char *location;
    char *description;
    char *required;
    char *conflicts;
    char *suggests;
    char *file_ext;
    uint32_t size_c;
    uint32_t size_u;
    uint32_t priority;
    bool installed;
  } slapt_pkg_info_t;
.fi
.sp
.TP
The \fIslapt_pkg_info_t\fP object is created and freed with \fIslapt_init_pkg\fP() and \fIslapt_free_pkg\fP().  A \fIslapt_pkg_info_t\fP can also be copied with \fIslapt_copy_pkg\fP().
.sp
.nf
.B "__inline slapt_pkg_info_t *slapt_init_pkg(void);"
.B "void slapt_free_pkg(slapt_pkg_info_t *pkg);"
.B "slapt_pkg_info_t *slapt_copy_pkg(slapt_pkg_info_t *dst,"
.B "                                 slapt_pkg_info_t *src);"
.fi
.sp
.TP
Package lists are useful for grouping packages from the existing installed packages, packages available from external sources, a list of dependencies, and more.  Package lists are stored within a \fIslapt_vector_t\fP.
.sp
.TP
Package lists can be parsed from PACKAGES.TXT or similar formated files (such as the working_dir/package_data file used by slapt-get) with \fIslapt_parse_packages_txt\fP().  A package list of the currently installed packages is returned by \fIslapt_get_installed_pkgs\fP().  \fIslapt_get_available_pkgs\fP() is a frontend to \fIslapt_parse_packages_txt\fP() looking for a package_data file in the current directory.  All three of the following set \fIfree_pkgs\fP to TRUE.
.sp
.nf
.B "slapt_vector_t *slapt_parse_packages_txt(FILE *);"
.B "slapt_vector_t *slapt_get_available_pkgs(void);"
.B "slapt_vector_t *slapt_get_installed_pkgs(void);"
.fi
.sp
.TP
Finding a specific package in a package list is done through one of the following functions.  All return \fIslapt_pkg_info_t\fP, or NULL on error, except for \fIslapt_search_pkg_list\fP() which returns a list of packages as \fIslapt_vector_t\fP.
.sp
.nf
.B "slapt_pkg_info_t *slapt_get_newest_pkg(slapt_vector_t *,"
.B "                                       const char *);"
.B "slapt_pkg_info_t *slapt_get_exact_pkg(slapt_vector_t *list,"
.B "                                      const char *name,"
.B "                                      const char *version);"
.B "slapt_pkg_info_t *slapt_get_pkg_by_details(slapt_vector_t *list,"
.B "                                           const char *name,"
.B "                                           const char *version,"
.B "                                           const char *location);"
.B "slapt_vector_t *slapt_search_pkg_list(slapt_vector_t *list,"
.B "                                             const char *pattern);"
.fi
.sp
.TP
Passing a package to \fIinstallpkg\fP, \fIupgradepkg\fP, and \fIremovepkg\fP is done through the following functions.  All return 0 upon success, or non-zero on error.
.sp
.nf
.B "int slapt_install_pkg(const slapt_rc_config *,slapt_pkg_info_t *);"
.B "int slapt_upgrade_pkg(const slapt_rc_config *global_config,"
.B "                      slapt_pkg_info_t *pkg);"
.B "int slapt_remove_pkg(const slapt_rc_config *,slapt_pkg_info_t *);"
.fi
.sp
.TP
Comparing package versions is done with the \fIslapt_cmp_pkgs\fP functions.  It calls \fIslapt_cmp_pkg_versions\fP() which returns just like strcmp, greater than 0 if a is greater than b, less than 0 if a is less than b, or 0 if a and b are equal.
.sp
.nf
.B "int slapt_cmp_pkg_versions(const char *a, const char *b);"
.B "int slapt_cmp_pkgs(slapt_pkg_info_t *a, slapt_pkg_info_t *b);"
.fi
.sp
.TP
The following functions deal with determining package dependencies and conflicts and returning them within a package list.  Some require the use of a \fIslapt_vector_t\fP of \fIslapt_pkg_err_t\fP objects for reporting errors on which packages failed or were missing.  \fIslapt_search_pkg_err_list\fP() returns 0 if the package and error string combination does not already exist in the \fIslapt_vector_t\fP, or 1 if found.
.sp
.nf
  typedef struct {
    char *pkg;
    char *error;
  } slapt_pkg_err_t;
.sp
.fi
.TP
\fIslapt_get_pkg_dependencies\fP() fills a \fIslapt_vector_t\fP of dependencies for the specified package.  These dependencies are pulled from the available package list and the installed package lists.  Missing and conflict errors are placed in \fIslapt_vector_t\fP.  \fIdeps\fP, \fIconflict_err\fP, and \fImissing_err\fP are initialized if NULL.  \fIslapt_get_pkg_dependencies\fP() returns 0 on success, or -1 on error.
.sp
.nf
.B "int slapt_get_pkg_dependencies(const slapt_rc_config *global_config,
.B "                               slapt_vector_t *avail_pkgs,
.B "                               slapt_vector_t *installed_pkgs,
.B "                               slapt_pkg_info_t *pkg,
.B "                               slapt_vector_t *deps,
.B "                               slapt_vector_t *conflict_err,
.B "                               slapt_vector_t *missing_err);"
.sp
.fi
.TP
\fIslapt_get_pkg_conflicts\fP() returns a \fIslapt_vector_t\fP of packages that conflict with the specified package.
.sp
.nf
.B "slapt_vector_t *"
.B "slapt_get_pkg_conflicts(slapt_vector_t *avail_pkgs,
.B "                        slapt_vector_t *installed_pkgs,
.B "                        slapt_pkg_info_t *pkg);"
.sp
.fi
.TP
\fIslapt_is_required_by\fP() returns a \fIslapt_vector_t\fP of packages that require the package specified.
.sp
.nf
.B "slapt_vector_t *"
.B "slapt_is_required_by(const slapt_rc_config *global_config,
.B "                     slapt_vector_t *avail,
.B "                     slapt_vector_t *installed_pkgs,
.B "                     slapt_vector_t *pkgs_to_install,
.B "                     slapt_vector_t *pkgs_to_remove,
.B "                     slapt_pkg_info_t *pkg);"
.sp
.fi
.TP
\fIslapt_get_obsolete_pkgs\fP() returns a \fIslapt_vector_t\fP of packages that are no longer available from the current package sources.
.sp
.nf
.B "slapt_vector_t *"
.B "  slapt_get_obsolete_pkgs ( const slapt_rc_config *global_config,"
.B "                            slapt_vector_t *avail_pkgs,"
.B "                            slapt_vector_t *installed_pkgs);"
.B "
.sp
.fi
.TP
\fIslapt_is_excluded\fP() returns 1 if package is present in the exclude list, 0 if not.
.sp
.nf
.B "int slapt_is_excluded(const slapt_rc_config *,slapt_pkg_info_t *);"
.fi
.sp
.TP
\fIslapt_get_pkg_changelog\fP() returns the package changelog entry, if any.  Otherwise returns NULL.  Assumes already chdir'd to the working directory.
.sp
.nf
.B "char *slapt_get_pkg_changelog(const slapt_pkg_info_t *pkg);"
.fi
.sp
.TP
\fIslapt_get_pkg_filelist\fP() returns a string representing all of the files installed by the package.  This list is read from the package log file.  
.sp
.nf
.B "char *slapt_get_pkg_filelist(const slapt_pkg_info_t *pkg);"
.fi
.sp
.TP
\fIslapt_stringify_pkg\fP() returns a string representation of the package.
.sp
.nf
.B "char *slapt_stringify_pkg(const slapt_pkg_info_t *pkg);"
.fi
.sp
.TP
\fIslapt_gen_package_log_dir_name\fP() returns a string location of the package log directory, accounting for the value of the ROOT environment variable, if set.  
.sp
.nf
.B "char *slapt_gen_package_log_dir_name(void);"
.fi
.sp
.TP
The \fIworking_dir\fP, defined within the \fIslapt_rc_config\fP object, caches the downloaded packages.  At various times it becomes necessary to purge the package cache.  \fIslapt_clean_pkg_dir\fP() unlinks all packages within the specified directory location.  \fIslapt_purge_old_cached_pkgs\fP() unlinks only packages that are not present in the current sources and thus are no longer downloadable.
.sp
.nf
.B "void slapt_clean_pkg_dir(const char *dir_name);"
.B "void slapt_purge_old_cached_pkgs(const slapt_rc_config *global_config,"
.B "                                 const char *dir_name,"
.B "                                 slapt_vector_t *avail_pkgs);"
.fi
.sp
.TP
The \fIslapt_clean_description\fP() function is used to clean the package name from the package description.  This modifies the string in place.  It is best to copy the \fIpkg->description\fP to a new string prior to calling \fIslapt_clean_description\fP().
.sp
.nf
.B void slapt_clean_description (char *description, const char *name);
.fi
.sp
.IP \fBDOWNLOADING\fP
.TP
Downloading packages and the package data from various sources is handled with the following functions.  Functions with integer return types return non-zero on error.  \fIslapt_update_pkg_cache\fP() and \fIslapt_get_available_pkgs\fP() assume to be chdir'd to the working directory.
.sp
.nf
.B "int slapt_download_data(FILE *fh, const char *url, size_t bytes, long *filetime,"
.B "                  const slapt_rc_config *global_config);"
.B "int slapt_update_pkg_cache(const slapt_rc_config *global_config);"
.B "const char *slapt_download_pkg(const slapt_rc_config *global_config,"
.B "                       slapt_pkg_info_t *pkg);"
.B "slapt_code_t slapt_verify_downloaded_pkg(const slapt_rc_config *global_config,"
.B "                                slapt_pkg_info_t *pkg);"
.sp
.B "const char *slapt_get_mirror_data_from_source(FILE *fh,"
.B "                                      const slapt_rc_config *global_config,"
.B "                                      const char *base_url,"
.B "                                      const char *filename);"
.B "char *slapt_head_request(const char *url);"
.B "char *slapt_head_mirror_data(const char *wurl,const char *file);"
.B "void slapt_clear_head_cache(const char *cache_filename);"
.B "void slapt_write_head_cache(const char *cache, const char *cache_filename);"
.B "char *slapt_read_head_cache(const char *cache_filename);"
.fi
.sp
.TP
The following functions download the PACKAGES.TXT, the patches/PACKAGES.TXT, CHECKSUMS.md5, and ChangeLog.txt.  Each sets the compressed option if a compressed version was available and retrieved.
.sp
.nf
.B "slapt_vector_t *"
.B "slapt_get_pkg_source_packages (const slapt_rc_config *global_config,"
.B "                               const char *url, bool *compressed);"
.B "slapt_vector_t *"
.B "slapt_get_pkg_source_patches (const slapt_rc_config *global_config,"
.B "                              const char *url, bool *compressed);"
.B "FILE *slapt_get_pkg_source_checksums (const slapt_rc_config *global_config,"
.B "                                      const char *url, bool *compressed);"
.B "int slapt_get_pkg_source_changelog (const slapt_rc_config *global_config,"
.B "                                      const char *url, bool *compressed);"
.fi
.sp
.TP
Progress callbacks make use of \fIstruct slapt_progress_data\fP.
.sp
.nf
  struct slapt_progress_data
  {
    size_t bytes;
    time_t start;
  };
.sp
.B "struct slapt_progress_data *slapt_init_progress_data(void);"
.B "void slapt_free_progress_data(struct slapt_progress_data *d);"
.sp
.IP \fBTRANSACTIONS\fP
.TP
Adding, removing, and upgrading packages can be wrapped in a \fIslapt_transaction_t\fP object.  This structure will make sure that all packages are worked on in the specific order, downloaded, and handed off to the appropriate pkgtools command via the \fIslapt_handle_transaction\fP() function.
.sp
.nf
  enum slapt_action {
    USAGE = 0, UPDATE, INSTALL, REMOVE, SHOW, SEARCH, UPGRADE,
    LIST, INSTALLED, CLEAN, SHOWVERSION, AUTOCLEAN, AVAILABLE
  };
.sp
  typedef struct {
    union { slapt_pkg_info_t *i; slapt_pkg_upgrade_t *u; } pkg;
    uint32_t type; /* this is enum slapt_action */
  } slapt_queue_i;
.sp
  typedef struct {
    slapt_pkg_info_t *installed;
    slapt_pkg_info_t *upgrade;
    bool reinstall;
  } slapt_pkg_upgrade_t;
.sp
  typedef struct {
    slapt_vector_t *install_pkgs;
    slapt_vector_t *upgrade_pkgs;
    slapt_vector_t *remove_pkgs;
    slapt_vector_t *exclude_pkgs;
    slapt_vector_t *suggests;
    slapt_vector_t *conflict_err;
    slapt_vector_t *missing_err;
    slapt_vector_t *queue;
  } slapt_transaction_t;
.sp
.B "slapt_transaction_t *slapt_init_transaction(void);"
.B "void slapt_free_transaction(slapt_transaction_t *);"
.B "int slapt_handle_transaction(const slapt_rc_config *,slapt_transaction_t *);"
.sp
.B "void slapt_add_install_to_transaction(slapt_transaction_t *,"
.B "                                      slapt_pkg_info_t *pkg);"
.sp
.B "void slapt_add_remove_to_transaction(slapt_transaction_t *,"
.B "                                     slapt_pkg_info_t *pkg);"
.sp
.B "void slapt_add_upgrade_to_transaction(slapt_transaction_t *,"
.B "                                      slapt_pkg_info_t *installed_pkg,"
.B "                                      slapt_pkg_info_t *upgrade_pkg);"
.sp
.B "void slapt_add_reinstall_to_transaction(slapt_transaction_t *,"
.B "                                      slapt_pkg_info_t *installed_pkg,"
.B "                                      slapt_pkg_info_t *upgrade_pkg);"
.sp
.B "void slapt_add_exclude_to_transaction(slapt_transaction_t *,"
.B "                                      slapt_pkg_info_t *pkg);"
.sp
.B "slapt_transaction_t *slapt_remove_from_transaction(slapt_transaction_t *tran,"
.B "                                                   slapt_pkg_info_t *pkg);"
.sp
.B "int slapt_search_transaction(slapt_transaction_t *,char *pkg_name);"
.B "int slapt_search_transaction_by_pkg(slapt_transaction_t *tran,"
.B "                                    slapt_pkg_info_t *pkg);"
.sp
.B "int slapt_search_upgrade_transaction(slapt_transaction_t *tran,"
.B "                                     slapt_pkg_info_t *pkg);"
.sp
.B "int slapt_add_deps_to_trans(const slapt_rc_config *global_config,"
.B "                            slapt_transaction_t *tran,"
.B "                            slapt_vector_t *avail_pkgs,"
.B "                            slapt_vector_t *installed_pkgs,"
.B "                            slapt_pkg_info_t *pkg);"
.sp
.B "slapt_pkg_info_t *slapt_is_conflicted(slapt_transaction_t *tran,"
.B "                                      slapt_vector_t *avail_pkgs,"
.B "                                      slapt_vector_t *installed_pkgs,"
.B "                                      slapt_pkg_info_t *pkg);"
.sp
.B "void slapt_generate_suggestions(slapt_transaction_t *tran);"
.fi
.sp
.IP \fBGPG\fP
.TP
Functionality for GPG verification of package sources.
.sp
.TP
Retrieve the signature file for CHECKSUMS.md5 (or the signature for CHECKSUMS.md5.gz).  Sets compressed depending on which was found.
.nf
.B "FILE *slapt_get_pkg_source_checksums_signature (const slapt_rc_config *global_config,"
.B "                                                const char *url,"
.B "                                                bool *compressed);"
.fi
.sp
.TP
Retrieve the GPG-KEY file from the package source, if available.  Returns NULL if not found.
.nf
.B "FILE *slapt_get_pkg_source_gpg_key(const slapt_rc_config *global_config,"
.B "                                   const char *url,"
.B "                                   bool *compressed);"
.fi
.sp
.TP
Add the GPG-Key to the local keyring. Returns one of the following: SLAPT_GPG_KEY_IMPORTED, SLAPT_GPG_KEY_NOT_IMPORTED, or SLAPT_GPG_KEY_UNCHANGED.
.nf
.B "slapt_code_t slapt_add_pkg_source_gpg_key (FILE *key);"
.fi
.sp
.TP
Verify the signature is valid for the compressed or uncompressed checksum.  Returns one of the following: SLAPT_CHECKSUMS_VERIFIED, SLAPT_CHECKSUMS_MISSING_KEY, or SLAPT_CHECKSUMS_NOT_VERIFIED.
.nf
.B "slapt_code_t slapt_gpg_verify_checksums(FILE *checksums, FILE *signature);"
.sp
.fi
.IP \fBMISCELLANEOUS\fP
.TP
Miscellaneous functionality within libslapt.
.sp
.nf
  typedef struct {
    regmatch_t pmatch[SLAPT_MAX_REGEX_PARTS];
    regex_t regex;
    size_t nmatch;
    int reg_return;
  } slapt_regex_t;
.sp
.B "FILE *slapt_open_file(const char *file_name,const char *mode);"
.B "slapt_regex_t *slapt_init_regex(const char *regex_string);"
.B "void slapt_execute_regex(slapt_regex_t *regex_t,const char *string);"
.B "void slapt_free_regex(slapt_regex_t *regex_t);"
.B "void slapt_create_dir_structure(const char *dir_name);"
.B "void slapt_gen_md5_sum_of_file(FILE *f,char *result_sum);"
.B "int slapt_ask_yes_no(const char *format, ...);"
.B "char *slapt_str_replace_chr(const char *string,const char find,"
.B "                            const char replace);"
.B "__inline void *slapt_malloc(size_t s);"
.B "__inline void *slapt_calloc(size_t n,size_t s);"
.fi
.sp
.nf
  typedef enum {
    SLAPT_OK = 0,
    SLAPT_MD5_CHECKSUM_MISMATCH,
    SLAPT_MD5_CHECKSUM_MISSING,
    #ifdef SLAPT_HAS_GPGME
    SLAPT_GPG_KEY_IMPORTED,
    SLAPT_GPG_KEY_NOT_IMPORTED,
    SLAPT_GPG_KEY_UNCHANGED,
    SLAPT_CHECKSUMS_VERIFIED,
    SLAPT_CHECKSUMS_MISSING_KEY,
    SLAPT_CHECKSUMS_NOT_VERIFIED,
    #endif
    SLAPT_DOWNLOAD_INCOMPLETE
  } slapt_code_t;
.sp
.B "const char *slapt_strerror(slapt_code_t code);"
.sp
.nf
  typedef enum {
      SLAPT_PRIORITY_DEFAULT = 0,
      SLAPT_PRIORITY_DEFAULT_PATCH,
      SLAPT_PRIORITY_PREFERRED,
      SLAPT_PRIORITY_PREFERRED_PATCH,
      SLAPT_PRIORITY_OFFICIAL,
      SLAPT_PRIORITY_OFFICIAL_PATCH,
      SLAPT_PRIORITY_CUSTOM,
      SLAPT_PRIORITY_CUSTOM_PATCH
  } SLAPT_PRIORITY_T;
.sp
.B #define SLAPT_PRIORITY_DEFAULT_TOKEN "DEFAULT"
.B #define SLAPT_PRIORITY_PREFERRED_TOKEN "PREFERRED"
.B #define SLAPT_PRIORITY_OFFICIAL_TOKEN "OFFICIAL"
.B #define SLAPT_PRIORITY_CUSTOM_TOKEN "CUSTOM"
.sp
.B /* return human readable priority */
.B const char *slapt_priority_to_str(SLAPT_PRIORITY_T priority);
.sp
.B bool slapt_disk_space_check (const char *path,double space_needed);
.sp
.fi
.sp
.SH LINKING WITH LIBSLAPT
You must link with -lslapt and with libcurl through the curl-config script.  For example: `curl-config --libs` -lslapt.  Optionally, gpgme may be linked into libslapt, which requires `gpgme-config --libs`.
.SH SEE ALSO
.BR libcurl(3)
.BR zlib(3)
.SH AUTHOR
Jason Woodward <woodwardj@jaos.org>