annotate scripts/install.c @ 1189:95ae2805622f draft

Add Szabolcs Nagy's deflate/inflate code from git://git.suckless.org/flate Confirmed with him on IRC it's ok to use under toybox license, glued the files together and hammered square peg into round hole, no other changes yet.
author Rob Landley <rob@landley.net>
date Fri, 31 Jan 2014 06:01:30 -0600
parents 786841fdb1e0
children 5f8fe22a33b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
89
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 /* Wrapper to make installation easier with cross-compiling.
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
2 *
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 * Copyright 2006 Rob Landley <rob@landley.net>
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
4 */
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
5
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
6 #include "toys.h"
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
7
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
8 #undef NEWTOY
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
9 #undef OLDTOY
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
10 #define NEWTOY(name, opts, flags) {#name, 0, opts, flags},
91
b596b9b3b2af Missing comma, and slight simplification in defconfig sed invocation.
Rob Landley <rob@landley.net>
parents: 89
diff changeset
11 #define OLDTOY(name, oldname, opts, flags) {#name, 0, opts, flags},
89
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
12
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
13 // Populate toy_list[].
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
14
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
15 struct toy_list toy_list[] = {
237
7cb15eae1664 Zap toylist.h, moving contents of global structures into DEFINE_GLOBALS()
Rob Landley <rob@landley.net>
parents: 91
diff changeset
16 #include "generated/newtoys.h"
89
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
17 };
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
18
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
19 #define TOY_LIST_LEN (sizeof(toy_list)/sizeof(struct toy_list))
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
20
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
21 int main(int argc, char *argv[])
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
22 {
694
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 237
diff changeset
23 static char *toy_paths[]={"usr/","bin/","sbin/",0};
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 237
diff changeset
24 int i, len = 0;
89
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
25
694
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 237
diff changeset
26 // Output list of applets.
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 237
diff changeset
27 for (i=1; i<TOY_LIST_LEN; i++) {
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 237
diff changeset
28 int fl = toy_list[i].flags;
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 237
diff changeset
29 if (fl & TOYMASK_LOCATION) {
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 237
diff changeset
30 if (argc>1) {
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 237
diff changeset
31 int j;
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 237
diff changeset
32 for (j=0; toy_paths[j]; j++)
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 237
diff changeset
33 if (fl & (1<<j)) len += printf("%s", toy_paths[j]);
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 237
diff changeset
34 }
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 237
diff changeset
35 len += printf("%s\n",toy_list[i].name);
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 237
diff changeset
36 }
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 237
diff changeset
37 }
786841fdb1e0 Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
Rob Landley <rob@landley.net>
parents: 237
diff changeset
38 return 0;
89
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents:
diff changeset
39 }