words = Arrays.asList(contents.split("\\PL+"));
-
- long count = 0;
- for(String w : words)
- {
- if(w.length() > 12 ) count++;
- }
-
- System.out.println(count);
-
- count = words.stream().filter(w -> w.length() > 12).count();
- System.out.println(count);
-
- count = words.parallelStream().filter(w -> w.length() > 12 ).count();
- System.out.println(count);
- }
-}
diff --git a/java/testProject/src/text/TextComponentFrame.java b/java/testProject/src/text/TextComponentFrame.java
deleted file mode 100644
index 1825ca6..0000000
--- a/java/testProject/src/text/TextComponentFrame.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package text;
-
-import javax.swing.*;
-import java.awt.*;
-
-public class TextComponentFrame extends JFrame {
- public static final int TEXTAREA_ROWS = 8;
- public static final int TEXTAREA_COLUMNS = 20;
-
- public TextComponentFrame()
- {
- JTextField textField = new JTextField();
- JPasswordField passwordField = new JPasswordField();
-
- JPanel northPanel = new JPanel();
- northPanel.setLayout(new GridLayout(2,2));
- northPanel.add(new JLabel("User name:",SwingConstants.RIGHT));
- northPanel.add(textField);
- northPanel.add(new JLabel("Password:",SwingConstants.RIGHT));
- northPanel.add(passwordField);
-
- add(northPanel, BorderLayout.NORTH);
-
- JTextArea textArea = new JTextArea(TEXTAREA_ROWS,TEXTAREA_COLUMNS);
-
- JScrollPane scrollPane = new JScrollPane(textArea);
-
- add(scrollPane,BorderLayout.CENTER);
-
- JPanel southPanel = new JPanel();
-
- JButton insertButton = new JButton("Insert");
- southPanel.add(insertButton);
- insertButton.addActionListener(event->textArea.append("User name:" + textField.getText() + "Password:" +
- new String(passwordField.getPassword()) + "\n"));
-
- add(southPanel, BorderLayout.SOUTH);
- pack();
- }
-}
diff --git a/java/testProject/src/text/TextComponentFrameTest.java b/java/testProject/src/text/TextComponentFrameTest.java
deleted file mode 100644
index 1069fca..0000000
--- a/java/testProject/src/text/TextComponentFrameTest.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package text;
-
-import javax.swing.*;
-import java.awt.*;
-import java.util.Queue;
-
-public class TextComponentFrameTest {
- public static void main(String[] args)
- {
- EventQueue.invokeLater(()->{
- JFrame frame = new TextComponentFrame();
- frame.setTitle("Text");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.setVisible(true);
- });
-
-
- }
-}
diff --git a/java/testProject/src/unsynch/Bank.java b/java/testProject/src/unsynch/Bank.java
deleted file mode 100644
index b6525ba..0000000
--- a/java/testProject/src/unsynch/Bank.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package unsynch;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-public class Bank {
- private final double[] accounts;
-
- public Bank(int n, double initialBalance)
- {
- accounts = new double[n];
- Arrays.fill(accounts,initialBalance);
- }
-
- public void transfer(int from, int to, double amount)
- {
- if(accounts[from] < amount) return;
- System.out.print(Thread.currentThread());
- accounts[from] -= amount;
- System.out.printf(" %10.2f from %d to %d", amount, from, to);
- accounts[to] += amount;
- System.out.printf("Total Balance: %10.2f%n", getTotalBalance());
- }
-
- public double getTotalBalance()
- {
- double sum = 0;
-
- for(double a:accounts)
- sum += a;
- return sum;
- }
-
- public int size()
- {
- return accounts.length;
- }
-}
diff --git a/java/testProject/src/unsynch/UnsynchBankTest.java b/java/testProject/src/unsynch/UnsynchBankTest.java
deleted file mode 100644
index 212c76b..0000000
--- a/java/testProject/src/unsynch/UnsynchBankTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package unsynch;
-
-public class UnsynchBankTest {
- public static final int NACCOUNTS = 100;
- public static final double INITIAL_BALANCE = 1000;
- public static final double MAX_AMOUNT = 1000;
- public static final int DELAY = 10;
-
- public static void main(String[] args)
- {
- Bank bank = new Bank(NACCOUNTS, INITIAL_BALANCE);
- for(int i = 0; i < NACCOUNTS; i++)
- {
- int fromAccount = i;
- Runnable r = () -> {
- try
- {
- while(true)
- {
- int toAccount = (int) (bank.size() * Math.random());
- double amount = MAX_AMOUNT * Math.random();
- bank.transfer(fromAccount, toAccount, amount);
- Thread.sleep((int) (DELAY * Math.random()));
- }
- }
- catch (InterruptedException e)
- {
-
- }
- };
- Thread t = new Thread(r);
- t.start();
- }
- }
-}
diff --git "a/knowledge/\345\210\206\345\270\203\345\274\217.txt" "b/knowledge/\345\210\206\345\270\203\345\274\217.txt"
new file mode 100644
index 0000000..0b7d3fd
--- /dev/null
+++ "b/knowledge/\345\210\206\345\270\203\345\274\217.txt"
@@ -0,0 +1,2 @@
+分布式系统的Raft算法
+Paxos
\ No newline at end of file
diff --git a/laravel54/composer.lock b/laravel54/composer.lock
new file mode 100644
index 0000000..5969a71
--- /dev/null
+++ b/laravel54/composer.lock
@@ -0,0 +1,4011 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "da365ca7e8f2cfa9eeab99c06f02ea15",
+ "packages": [
+ {
+ "name": "dflydev/apache-mime-types",
+ "version": "v1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/dflydev/dflydev-apache-mime-types.git",
+ "reference": "f30a57e59b7476e4c5270b6a0727d79c9c0eb861"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/dflydev/dflydev-apache-mime-types/zipball/f30a57e59b7476e4c5270b6a0727d79c9c0eb861",
+ "reference": "f30a57e59b7476e4c5270b6a0727d79c9c0eb861",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3"
+ },
+ "require-dev": {
+ "twig/twig": "1.*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Dflydev\\ApacheMimeTypes": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Dragonfly Development Inc.",
+ "email": "info@dflydev.com",
+ "homepage": "http://dflydev.com"
+ },
+ {
+ "name": "Beau Simensen",
+ "email": "beau@dflydev.com",
+ "homepage": "http://beausimensen.com"
+ }
+ ],
+ "description": "Apache MIME Types",
+ "keywords": [
+ "apache",
+ "mime",
+ "mimetypes"
+ ],
+ "time": "2013-05-14T02:02:01+00:00"
+ },
+ {
+ "name": "dnoegel/php-xdg-base-dir",
+ "version": "0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/dnoegel/php-xdg-base-dir.git",
+ "reference": "265b8593498b997dc2d31e75b89f053b5cc9621a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/265b8593498b997dc2d31e75b89f053b5cc9621a",
+ "reference": "265b8593498b997dc2d31e75b89f053b5cc9621a",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "@stable"
+ },
+ "type": "project",
+ "autoload": {
+ "psr-4": {
+ "XdgBaseDir\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "implementation of xdg base directory specification for php",
+ "time": "2014-10-24T07:27:01+00:00"
+ },
+ {
+ "name": "doctrine/inflector",
+ "version": "v1.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/inflector.git",
+ "reference": "90b2128806bfde671b6952ab8bea493942c1fdae"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae",
+ "reference": "90b2128806bfde671b6952ab8bea493942c1fdae",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "4.*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Doctrine\\Common\\Inflector\\": "lib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Roman Borschel",
+ "email": "roman@code-factory.org"
+ },
+ {
+ "name": "Benjamin Eberlei",
+ "email": "kontakt@beberlei.de"
+ },
+ {
+ "name": "Guilherme Blanco",
+ "email": "guilhermeblanco@gmail.com"
+ },
+ {
+ "name": "Jonathan Wage",
+ "email": "jonwage@gmail.com"
+ },
+ {
+ "name": "Johannes Schmitt",
+ "email": "schmittjoh@gmail.com"
+ }
+ ],
+ "description": "Common String Manipulations with regard to casing and singular/plural rules.",
+ "homepage": "http://www.doctrine-project.org",
+ "keywords": [
+ "inflection",
+ "pluralize",
+ "singularize",
+ "string"
+ ],
+ "time": "2015-11-06T14:35:42+00:00"
+ },
+ {
+ "name": "erusev/parsedown",
+ "version": "1.6.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/erusev/parsedown.git",
+ "reference": "20ff8bbb57205368b4b42d094642a3e52dac85fb"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/erusev/parsedown/zipball/20ff8bbb57205368b4b42d094642a3e52dac85fb",
+ "reference": "20ff8bbb57205368b4b42d094642a3e52dac85fb",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "Parsedown": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Emanuil Rusev",
+ "email": "hello@erusev.com",
+ "homepage": "http://erusev.com"
+ }
+ ],
+ "description": "Parser for Markdown.",
+ "homepage": "http://parsedown.org",
+ "keywords": [
+ "markdown",
+ "parser"
+ ],
+ "time": "2016-11-02T15:56:58+00:00"
+ },
+ {
+ "name": "jakub-onderka/php-console-color",
+ "version": "0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/JakubOnderka/PHP-Console-Color.git",
+ "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/e0b393dacf7703fc36a4efc3df1435485197e6c1",
+ "reference": "e0b393dacf7703fc36a4efc3df1435485197e6c1",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.2"
+ },
+ "require-dev": {
+ "jakub-onderka/php-code-style": "1.0",
+ "jakub-onderka/php-parallel-lint": "0.*",
+ "jakub-onderka/php-var-dump-check": "0.*",
+ "phpunit/phpunit": "3.7.*",
+ "squizlabs/php_codesniffer": "1.*"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "JakubOnderka\\PhpConsoleColor": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-2-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jakub Onderka",
+ "email": "jakub.onderka@gmail.com",
+ "homepage": "http://www.acci.cz"
+ }
+ ],
+ "time": "2014-04-08T15:00:19+00:00"
+ },
+ {
+ "name": "jakub-onderka/php-console-highlighter",
+ "version": "v0.3.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git",
+ "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/7daa75df45242c8d5b75a22c00a201e7954e4fb5",
+ "reference": "7daa75df45242c8d5b75a22c00a201e7954e4fb5",
+ "shasum": ""
+ },
+ "require": {
+ "jakub-onderka/php-console-color": "~0.1",
+ "php": ">=5.3.0"
+ },
+ "require-dev": {
+ "jakub-onderka/php-code-style": "~1.0",
+ "jakub-onderka/php-parallel-lint": "~0.5",
+ "jakub-onderka/php-var-dump-check": "~0.1",
+ "phpunit/phpunit": "~4.0",
+ "squizlabs/php_codesniffer": "~1.5"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "JakubOnderka\\PhpConsoleHighlighter": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jakub Onderka",
+ "email": "acci@acci.cz",
+ "homepage": "http://www.acci.cz/"
+ }
+ ],
+ "time": "2015-04-20T18:58:01+00:00"
+ },
+ {
+ "name": "jeremeamia/superclosure",
+ "version": "2.4.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/jeremeamia/super_closure.git",
+ "reference": "5707d5821b30b9a07acfb4d76949784aaa0e9ce9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/jeremeamia/super_closure/zipball/5707d5821b30b9a07acfb4d76949784aaa0e9ce9",
+ "reference": "5707d5821b30b9a07acfb4d76949784aaa0e9ce9",
+ "shasum": ""
+ },
+ "require": {
+ "nikic/php-parser": "^1.2|^2.0|^3.0|^4.0",
+ "php": ">=5.4",
+ "symfony/polyfill-php56": "^1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.0|^5.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.4-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "SuperClosure\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jeremy Lindblom",
+ "email": "jeremeamia@gmail.com",
+ "homepage": "https://github.com/jeremeamia",
+ "role": "Developer"
+ }
+ ],
+ "description": "Serialize Closure objects, including their context and binding",
+ "homepage": "https://github.com/jeremeamia/super_closure",
+ "keywords": [
+ "closure",
+ "function",
+ "lambda",
+ "parser",
+ "serializable",
+ "serialize",
+ "tokenizer"
+ ],
+ "time": "2018-03-21T22:21:57+00:00"
+ },
+ {
+ "name": "laravel/framework",
+ "version": "v5.4.9",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/laravel/framework.git",
+ "reference": "600330ae1d218919b3b307e0578461a2df248663"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/laravel/framework/zipball/600330ae1d218919b3b307e0578461a2df248663",
+ "reference": "600330ae1d218919b3b307e0578461a2df248663",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/inflector": "~1.0",
+ "erusev/parsedown": "~1.6",
+ "ext-mbstring": "*",
+ "ext-openssl": "*",
+ "league/flysystem": "~1.0",
+ "monolog/monolog": "~1.11",
+ "mtdowling/cron-expression": "~1.0",
+ "nesbot/carbon": "~1.20",
+ "paragonie/random_compat": "~1.4|~2.0",
+ "php": ">=5.6.4",
+ "ramsey/uuid": "~3.0",
+ "swiftmailer/swiftmailer": "~5.4",
+ "symfony/console": "~3.2",
+ "symfony/debug": "~3.2",
+ "symfony/finder": "~3.2",
+ "symfony/http-foundation": "~3.2",
+ "symfony/http-kernel": "~3.2",
+ "symfony/process": "~3.2",
+ "symfony/routing": "~3.2",
+ "symfony/var-dumper": "~3.2",
+ "tijsverkoyen/css-to-inline-styles": "~2.2",
+ "vlucas/phpdotenv": "~2.2"
+ },
+ "replace": {
+ "illuminate/auth": "self.version",
+ "illuminate/broadcasting": "self.version",
+ "illuminate/bus": "self.version",
+ "illuminate/cache": "self.version",
+ "illuminate/config": "self.version",
+ "illuminate/console": "self.version",
+ "illuminate/container": "self.version",
+ "illuminate/contracts": "self.version",
+ "illuminate/cookie": "self.version",
+ "illuminate/database": "self.version",
+ "illuminate/encryption": "self.version",
+ "illuminate/events": "self.version",
+ "illuminate/exception": "self.version",
+ "illuminate/filesystem": "self.version",
+ "illuminate/hashing": "self.version",
+ "illuminate/http": "self.version",
+ "illuminate/log": "self.version",
+ "illuminate/mail": "self.version",
+ "illuminate/notifications": "self.version",
+ "illuminate/pagination": "self.version",
+ "illuminate/pipeline": "self.version",
+ "illuminate/queue": "self.version",
+ "illuminate/redis": "self.version",
+ "illuminate/routing": "self.version",
+ "illuminate/session": "self.version",
+ "illuminate/support": "self.version",
+ "illuminate/translation": "self.version",
+ "illuminate/validation": "self.version",
+ "illuminate/view": "self.version",
+ "tightenco/collect": "self.version"
+ },
+ "require-dev": {
+ "aws/aws-sdk-php": "~3.0",
+ "doctrine/dbal": "~2.5",
+ "mockery/mockery": "~0.9.4",
+ "pda/pheanstalk": "~3.0",
+ "phpunit/phpunit": "~5.7",
+ "predis/predis": "~1.0",
+ "symfony/css-selector": "~3.2",
+ "symfony/dom-crawler": "~3.2"
+ },
+ "suggest": {
+ "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (~3.0).",
+ "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.5).",
+ "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).",
+ "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (~6.0).",
+ "laravel/tinker": "Required to use the tinker console command (~1.0).",
+ "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).",
+ "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).",
+ "nexmo/client": "Required to use the Nexmo transport (~1.0).",
+ "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0).",
+ "predis/predis": "Required to use the redis cache and queue drivers (~1.0).",
+ "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (~2.0).",
+ "symfony/css-selector": "Required to use some of the crawler integration testing tools (~3.2).",
+ "symfony/dom-crawler": "Required to use most of the crawler integration testing tools (~3.2).",
+ "symfony/psr-http-message-bridge": "Required to psr7 bridging features (0.2.*)."
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "5.4-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "src/Illuminate/Foundation/helpers.php",
+ "src/Illuminate/Support/helpers.php"
+ ],
+ "psr-4": {
+ "Illuminate\\": "src/Illuminate/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Taylor Otwell",
+ "email": "taylor@laravel.com"
+ }
+ ],
+ "description": "The Laravel Framework.",
+ "homepage": "https://laravel.com",
+ "keywords": [
+ "framework",
+ "laravel"
+ ],
+ "time": "2017-02-03T19:47:35+00:00"
+ },
+ {
+ "name": "laravel/tinker",
+ "version": "v1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/laravel/tinker.git",
+ "reference": "3d5b675b55b24ccbf86395964042dbe061d5a965"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/laravel/tinker/zipball/3d5b675b55b24ccbf86395964042dbe061d5a965",
+ "reference": "3d5b675b55b24ccbf86395964042dbe061d5a965",
+ "shasum": ""
+ },
+ "require": {
+ "illuminate/console": "~5.1",
+ "illuminate/contracts": "~5.1",
+ "illuminate/support": "~5.1",
+ "php": ">=5.5.9",
+ "psy/psysh": "0.7.*|0.8.*",
+ "symfony/var-dumper": "~3.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0|~5.0"
+ },
+ "suggest": {
+ "illuminate/database": "The Illuminate Database package (~5.1)."
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Laravel\\Tinker\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Taylor Otwell",
+ "email": "taylor@laravel.com"
+ }
+ ],
+ "description": "Powerful REPL for the Laravel framework.",
+ "keywords": [
+ "REPL",
+ "Tinker",
+ "laravel",
+ "psysh"
+ ],
+ "time": "2016-12-30T18:13:17+00:00"
+ },
+ {
+ "name": "league/flysystem",
+ "version": "1.0.34",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/thephpleague/flysystem.git",
+ "reference": "469ad53c13ea19a0e54e3e5d70f61227ddcc0299"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/469ad53c13ea19a0e54e3e5d70f61227ddcc0299",
+ "reference": "469ad53c13ea19a0e54e3e5d70f61227ddcc0299",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.9"
+ },
+ "conflict": {
+ "league/flysystem-sftp": "<1.0.6"
+ },
+ "require-dev": {
+ "ext-fileinfo": "*",
+ "mockery/mockery": "~0.9",
+ "phpspec/phpspec": "^2.2",
+ "phpunit/phpunit": "~4.8"
+ },
+ "suggest": {
+ "ext-fileinfo": "Required for MimeType",
+ "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2",
+ "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3",
+ "league/flysystem-azure": "Allows you to use Windows Azure Blob storage",
+ "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching",
+ "league/flysystem-copy": "Allows you to use Copy.com storage",
+ "league/flysystem-dropbox": "Allows you to use Dropbox storage",
+ "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem",
+ "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files",
+ "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib",
+ "league/flysystem-webdav": "Allows you to use WebDAV storage",
+ "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "League\\Flysystem\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Frank de Jonge",
+ "email": "info@frenky.net"
+ }
+ ],
+ "description": "Filesystem abstraction: Many filesystems, one API.",
+ "keywords": [
+ "Cloud Files",
+ "WebDAV",
+ "abstraction",
+ "aws",
+ "cloud",
+ "copy.com",
+ "dropbox",
+ "file systems",
+ "files",
+ "filesystem",
+ "filesystems",
+ "ftp",
+ "rackspace",
+ "remote",
+ "s3",
+ "sftp",
+ "storage"
+ ],
+ "time": "2017-01-30T17:41:17+00:00"
+ },
+ {
+ "name": "maatwebsite/excel",
+ "version": "2.1.30",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Maatwebsite/Laravel-Excel.git",
+ "reference": "f5540c4ba3ac50cebd98b09ca42e61f926ef299f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Maatwebsite/Laravel-Excel/zipball/f5540c4ba3ac50cebd98b09ca42e61f926ef299f",
+ "reference": "f5540c4ba3ac50cebd98b09ca42e61f926ef299f",
+ "shasum": ""
+ },
+ "require": {
+ "illuminate/cache": "^5.0",
+ "illuminate/config": "^5.0",
+ "illuminate/filesystem": "^5.0",
+ "illuminate/support": "^5.0",
+ "jeremeamia/superclosure": "^2.3",
+ "nesbot/carbon": "~1.0",
+ "php": ">=5.5",
+ "phpoffice/phpexcel": "^1.8.1",
+ "tijsverkoyen/css-to-inline-styles": "~2.0"
+ },
+ "require-dev": {
+ "mockery/mockery": "~1.0",
+ "orchestra/testbench": "3.1.*|3.2.*|3.3.*|3.4.*|3.5.*|3.6.*",
+ "phpseclib/phpseclib": "~1.0",
+ "phpunit/phpunit": "~4.0"
+ },
+ "suggest": {
+ "illuminate/http": "^5.0",
+ "illuminate/queue": "^5.0",
+ "illuminate/routing": "^5.0",
+ "illuminate/view": "^5.0"
+ },
+ "type": "library",
+ "extra": {
+ "laravel": {
+ "providers": [
+ "Maatwebsite\\Excel\\ExcelServiceProvider"
+ ],
+ "aliases": {
+ "Excel": "Maatwebsite\\Excel\\Facades\\Excel"
+ }
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/Maatwebsite/Excel"
+ ],
+ "psr-0": {
+ "Maatwebsite\\Excel\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Maatwebsite.nl",
+ "email": "patrick@maatwebsite.nl"
+ }
+ ],
+ "description": "Supercharged Excel exports in Laravel",
+ "keywords": [
+ "PHPExcel",
+ "batch",
+ "csv",
+ "excel",
+ "export",
+ "import",
+ "laravel"
+ ],
+ "time": "2018-09-04T19:00:09+00:00"
+ },
+ {
+ "name": "monolog/monolog",
+ "version": "1.22.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Seldaek/monolog.git",
+ "reference": "bad29cb8d18ab0315e6c477751418a82c850d558"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bad29cb8d18ab0315e6c477751418a82c850d558",
+ "reference": "bad29cb8d18ab0315e6c477751418a82c850d558",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0",
+ "psr/log": "~1.0"
+ },
+ "provide": {
+ "psr/log-implementation": "1.0.0"
+ },
+ "require-dev": {
+ "aws/aws-sdk-php": "^2.4.9 || ^3.0",
+ "doctrine/couchdb": "~1.0@dev",
+ "graylog2/gelf-php": "~1.0",
+ "jakub-onderka/php-parallel-lint": "0.9",
+ "php-amqplib/php-amqplib": "~2.4",
+ "php-console/php-console": "^3.1.3",
+ "phpunit/phpunit": "~4.5",
+ "phpunit/phpunit-mock-objects": "2.3.0",
+ "ruflin/elastica": ">=0.90 <3.0",
+ "sentry/sentry": "^0.13",
+ "swiftmailer/swiftmailer": "~5.3"
+ },
+ "suggest": {
+ "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
+ "doctrine/couchdb": "Allow sending log messages to a CouchDB server",
+ "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
+ "ext-mongo": "Allow sending log messages to a MongoDB server",
+ "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
+ "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
+ "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
+ "php-console/php-console": "Allow sending log messages to Google Chrome",
+ "rollbar/rollbar": "Allow sending log messages to Rollbar",
+ "ruflin/elastica": "Allow sending log messages to an Elastic Search server",
+ "sentry/sentry": "Allow sending log messages to a Sentry server"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Monolog\\": "src/Monolog"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jordi Boggiano",
+ "email": "j.boggiano@seld.be",
+ "homepage": "http://seld.be"
+ }
+ ],
+ "description": "Sends your logs to files, sockets, inboxes, databases and various web services",
+ "homepage": "http://github.com/Seldaek/monolog",
+ "keywords": [
+ "log",
+ "logging",
+ "psr-3"
+ ],
+ "time": "2016-11-26T00:15:39+00:00"
+ },
+ {
+ "name": "mtdowling/cron-expression",
+ "version": "v1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/mtdowling/cron-expression.git",
+ "reference": "9504fa9ea681b586028adaaa0877db4aecf32bad"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/mtdowling/cron-expression/zipball/9504fa9ea681b586028adaaa0877db4aecf32bad",
+ "reference": "9504fa9ea681b586028adaaa0877db4aecf32bad",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0|~5.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Cron\\": "src/Cron/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due",
+ "keywords": [
+ "cron",
+ "schedule"
+ ],
+ "abandoned": "dragonmantank/cron-expression",
+ "time": "2017-01-23T04:29:33+00:00"
+ },
+ {
+ "name": "nesbot/carbon",
+ "version": "1.22.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/briannesbitt/Carbon.git",
+ "reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc",
+ "reference": "7cdf42c0b1cc763ab7e4c33c47a24e27c66bfccc",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0",
+ "symfony/translation": "~2.6 || ~3.0"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "~2",
+ "phpunit/phpunit": "~4.0 || ~5.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.23-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Carbon\\": "src/Carbon/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Brian Nesbitt",
+ "email": "brian@nesbot.com",
+ "homepage": "http://nesbot.com"
+ }
+ ],
+ "description": "A simple API extension for DateTime.",
+ "homepage": "http://carbon.nesbot.com",
+ "keywords": [
+ "date",
+ "datetime",
+ "time"
+ ],
+ "time": "2017-01-16T07:55:07+00:00"
+ },
+ {
+ "name": "nikic/php-parser",
+ "version": "v3.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/nikic/PHP-Parser.git",
+ "reference": "5b8182cc0abb4b0ff290ba9df6c0e1323286013a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/5b8182cc0abb4b0ff290ba9df6c0e1323286013a",
+ "reference": "5b8182cc0abb4b0ff290ba9df6c0e1323286013a",
+ "shasum": ""
+ },
+ "require": {
+ "ext-tokenizer": "*",
+ "php": ">=5.5"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0|~5.0"
+ },
+ "bin": [
+ "bin/php-parse"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "PhpParser\\": "lib/PhpParser"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Nikita Popov"
+ }
+ ],
+ "description": "A PHP parser written in PHP",
+ "keywords": [
+ "parser",
+ "php"
+ ],
+ "time": "2017-02-03T21:57:31+00:00"
+ },
+ {
+ "name": "paragonie/random_compat",
+ "version": "v2.0.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/paragonie/random_compat.git",
+ "reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/paragonie/random_compat/zipball/a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e",
+ "reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.2.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "4.*|5.*"
+ },
+ "suggest": {
+ "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "lib/random.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Paragon Initiative Enterprises",
+ "email": "security@paragonie.com",
+ "homepage": "https://paragonie.com"
+ }
+ ],
+ "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
+ "keywords": [
+ "csprng",
+ "pseudorandom",
+ "random"
+ ],
+ "time": "2016-11-07T23:38:38+00:00"
+ },
+ {
+ "name": "pclzip/pclzip",
+ "version": "2.8.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/ivanlanin/pclzip.git",
+ "reference": "19dd1de9d3f5fc4d7d70175b4c344dee329f45fd"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/ivanlanin/pclzip/zipball/19dd1de9d3f5fc4d7d70175b4c344dee329f45fd",
+ "reference": "19dd1de9d3f5fc4d7d70175b4c344dee329f45fd",
+ "shasum": ""
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "pclzip.lib.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-2.1"
+ ],
+ "authors": [
+ {
+ "name": "Vincent Blavet"
+ }
+ ],
+ "description": "A PHP library that offers compression and extraction functions for Zip formatted archives",
+ "homepage": "http://www.phpconcept.net/pclzip",
+ "keywords": [
+ "php",
+ "zip"
+ ],
+ "time": "2014-06-05T11:42:24+00:00"
+ },
+ {
+ "name": "phpoffice/common",
+ "version": "0.2.9",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPOffice/Common.git",
+ "reference": "edb5d32b1e3400a35a5c91e2539ed6f6ce925e4d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPOffice/Common/zipball/edb5d32b1e3400a35a5c91e2539ed6f6ce925e4d",
+ "reference": "edb5d32b1e3400a35a5c91e2539ed6f6ce925e4d",
+ "shasum": ""
+ },
+ "require": {
+ "pclzip/pclzip": "^2.8",
+ "php": ">=5.3.0"
+ },
+ "require-dev": {
+ "phpdocumentor/phpdocumentor": "2.*",
+ "phploc/phploc": "2.*",
+ "phpmd/phpmd": "2.*",
+ "phpunit/phpunit": "^4.8.36 || ^7.0",
+ "sebastian/phpcpd": "2.*",
+ "squizlabs/php_codesniffer": "2.*"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "PhpOffice\\Common\\": "src/Common/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL"
+ ],
+ "authors": [
+ {
+ "name": "Mark Baker"
+ },
+ {
+ "name": "Franck Lefevre",
+ "homepage": "http://rootslabs.net"
+ }
+ ],
+ "description": "PHPOffice Common",
+ "homepage": "http://phpoffice.github.io",
+ "keywords": [
+ "common",
+ "component",
+ "office",
+ "php"
+ ],
+ "time": "2018-07-13T14:12:34+00:00"
+ },
+ {
+ "name": "phpoffice/phpexcel",
+ "version": "1.8.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPOffice/PHPExcel.git",
+ "reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/1441011fb7ecdd8cc689878f54f8b58a6805f870",
+ "reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870",
+ "shasum": ""
+ },
+ "require": {
+ "ext-mbstring": "*",
+ "ext-xml": "*",
+ "ext-xmlwriter": "*",
+ "php": "^5.2|^7.0"
+ },
+ "require-dev": {
+ "squizlabs/php_codesniffer": "2.*"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "PHPExcel": "Classes/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-2.1"
+ ],
+ "authors": [
+ {
+ "name": "Maarten Balliauw",
+ "homepage": "http://blog.maartenballiauw.be"
+ },
+ {
+ "name": "Erik Tilt"
+ },
+ {
+ "name": "Franck Lefevre",
+ "homepage": "http://rootslabs.net"
+ },
+ {
+ "name": "Mark Baker",
+ "homepage": "http://markbakeruk.net"
+ }
+ ],
+ "description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
+ "homepage": "https://github.com/PHPOffice/PHPExcel",
+ "keywords": [
+ "OpenXML",
+ "excel",
+ "php",
+ "spreadsheet",
+ "xls",
+ "xlsx"
+ ],
+ "abandoned": "phpoffice/phpspreadsheet",
+ "time": "2018-11-22T23:07:24+00:00"
+ },
+ {
+ "name": "phpoffice/phpword",
+ "version": "0.16.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHPOffice/PHPWord.git",
+ "reference": "7b7d4e4936014544aa706f4c03d3ac925d74beb9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHPOffice/PHPWord/zipball/7b7d4e4936014544aa706f4c03d3ac925d74beb9",
+ "reference": "7b7d4e4936014544aa706f4c03d3ac925d74beb9",
+ "shasum": ""
+ },
+ "require": {
+ "ext-xml": "*",
+ "php": "^5.3.3 || ^7.0",
+ "phpoffice/common": "^0.2.9",
+ "zendframework/zend-escaper": "^2.2"
+ },
+ "require-dev": {
+ "dompdf/dompdf": "0.8.*",
+ "ext-gd": "*",
+ "ext-zip": "*",
+ "friendsofphp/php-cs-fixer": "^2.2",
+ "mpdf/mpdf": "5.7.4 || 6.* || 7.*",
+ "php-coveralls/php-coveralls": "1.1.0 || ^2.0",
+ "phploc/phploc": "2.* || 3.* || 4.*",
+ "phpmd/phpmd": "2.*",
+ "phpunit/phpunit": "^4.8.36 || ^7.0",
+ "squizlabs/php_codesniffer": "^2.9",
+ "tecnickcom/tcpdf": "6.*"
+ },
+ "suggest": {
+ "dompdf/dompdf": "Allows writing PDF",
+ "ext-gd2": "Allows adding images",
+ "ext-xmlwriter": "Allows writing OOXML and ODF",
+ "ext-xsl": "Allows applying XSL style sheet to headers, to main document part, and to footers of an OOXML template",
+ "ext-zip": "Allows writing OOXML and ODF"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-develop": "0.17-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "PhpOffice\\PhpWord\\": "src/PhpWord"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-3.0"
+ ],
+ "authors": [
+ {
+ "name": "Mark Baker"
+ },
+ {
+ "name": "Gabriel Bull",
+ "email": "me@gabrielbull.com",
+ "homepage": "http://gabrielbull.com/"
+ },
+ {
+ "name": "Ivan Lanin",
+ "homepage": "http://ivan.lanin.org"
+ },
+ {
+ "name": "Roman Syroeshko",
+ "homepage": "http://ru.linkedin.com/pub/roman-syroeshko/34/a53/994/"
+ },
+ {
+ "name": "Franck Lefevre",
+ "homepage": "https://rootslabs.net/blog/"
+ },
+ {
+ "name": "Antoine de Troostembergh"
+ }
+ ],
+ "description": "PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)",
+ "homepage": "http://phpoffice.github.io",
+ "keywords": [
+ "ISO IEC 29500",
+ "OOXML",
+ "Office Open XML",
+ "OpenDocument",
+ "OpenXML",
+ "PhpOffice",
+ "PhpWord",
+ "Rich Text Format",
+ "WordprocessingML",
+ "doc",
+ "docx",
+ "html",
+ "odf",
+ "odt",
+ "office",
+ "pdf",
+ "php",
+ "reader",
+ "rtf",
+ "template",
+ "template processor",
+ "word",
+ "writer"
+ ],
+ "time": "2018-12-30T00:35:03+00:00"
+ },
+ {
+ "name": "psr/log",
+ "version": "1.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/log.git",
+ "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
+ "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Log\\": "Psr/Log/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for logging libraries",
+ "homepage": "https://github.com/php-fig/log",
+ "keywords": [
+ "log",
+ "psr",
+ "psr-3"
+ ],
+ "time": "2016-10-10T12:19:37+00:00"
+ },
+ {
+ "name": "psy/psysh",
+ "version": "v0.8.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/bobthecow/psysh.git",
+ "reference": "701e8a1cc426ee170f1296f5d9f6b8a26ad25c4a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/bobthecow/psysh/zipball/701e8a1cc426ee170f1296f5d9f6b8a26ad25c4a",
+ "reference": "701e8a1cc426ee170f1296f5d9f6b8a26ad25c4a",
+ "shasum": ""
+ },
+ "require": {
+ "dnoegel/php-xdg-base-dir": "0.1",
+ "jakub-onderka/php-console-highlighter": "0.3.*",
+ "nikic/php-parser": "~1.3|~2.0|~3.0",
+ "php": ">=5.3.9",
+ "symfony/console": "~2.3.10|^2.4.2|~3.0",
+ "symfony/var-dumper": "~2.7|~3.0"
+ },
+ "require-dev": {
+ "friendsofphp/php-cs-fixer": "~1.11",
+ "hoa/console": "~3.16|~1.14",
+ "phpunit/phpunit": "~4.4|~5.0",
+ "symfony/finder": "~2.1|~3.0"
+ },
+ "suggest": {
+ "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)",
+ "ext-pdo-sqlite": "The doc command requires SQLite to work.",
+ "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.",
+ "ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history.",
+ "hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit."
+ },
+ "bin": [
+ "bin/psysh"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-develop": "0.9.x-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "src/Psy/functions.php"
+ ],
+ "psr-4": {
+ "Psy\\": "src/Psy/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Justin Hileman",
+ "email": "justin@justinhileman.info",
+ "homepage": "http://justinhileman.com"
+ }
+ ],
+ "description": "An interactive shell for modern PHP.",
+ "homepage": "http://psysh.org",
+ "keywords": [
+ "REPL",
+ "console",
+ "interactive",
+ "shell"
+ ],
+ "time": "2017-01-15T17:54:13+00:00"
+ },
+ {
+ "name": "ramsey/uuid",
+ "version": "3.5.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/ramsey/uuid.git",
+ "reference": "5677cfe02397dd6b58c861870dfaa5d9007d3954"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/ramsey/uuid/zipball/5677cfe02397dd6b58c861870dfaa5d9007d3954",
+ "reference": "5677cfe02397dd6b58c861870dfaa5d9007d3954",
+ "shasum": ""
+ },
+ "require": {
+ "paragonie/random_compat": "^1.0|^2.0",
+ "php": ">=5.4"
+ },
+ "replace": {
+ "rhumsaa/uuid": "self.version"
+ },
+ "require-dev": {
+ "apigen/apigen": "^4.1",
+ "codeception/aspect-mock": "1.0.0",
+ "doctrine/annotations": "~1.2.0",
+ "goaop/framework": "1.0.0-alpha.2",
+ "ircmaxell/random-lib": "^1.1",
+ "jakub-onderka/php-parallel-lint": "^0.9.0",
+ "mockery/mockery": "^0.9.4",
+ "moontoast/math": "^1.1",
+ "php-mock/php-mock-phpunit": "^0.3|^1.1",
+ "phpunit/phpunit": "^4.7|>=5.0 <5.4",
+ "satooshi/php-coveralls": "^0.6.1",
+ "squizlabs/php_codesniffer": "^2.3"
+ },
+ "suggest": {
+ "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator",
+ "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator",
+ "ircmaxell/random-lib": "Provides RandomLib for use with the RandomLibAdapter",
+ "moontoast/math": "Provides support for converting UUID to 128-bit integer (in string form).",
+ "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid",
+ "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type."
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Ramsey\\Uuid\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Ben Ramsey",
+ "email": "ben@benramsey.com",
+ "homepage": "https://benramsey.com"
+ },
+ {
+ "name": "Marijn Huizendveld",
+ "email": "marijn.huizendveld@gmail.com"
+ },
+ {
+ "name": "Thibaud Fabre",
+ "email": "thibaud@aztech.io"
+ }
+ ],
+ "description": "Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID).",
+ "homepage": "https://github.com/ramsey/uuid",
+ "keywords": [
+ "guid",
+ "identifier",
+ "uuid"
+ ],
+ "time": "2016-11-22T19:21:44+00:00"
+ },
+ {
+ "name": "swiftmailer/swiftmailer",
+ "version": "v5.4.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/swiftmailer/swiftmailer.git",
+ "reference": "cd142238a339459b10da3d8234220963f392540c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/cd142238a339459b10da3d8234220963f392540c",
+ "reference": "cd142238a339459b10da3d8234220963f392540c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "mockery/mockery": "~0.9.1",
+ "symfony/phpunit-bridge": "~3.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "5.4-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "lib/swift_required.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Chris Corbyn"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ }
+ ],
+ "description": "Swiftmailer, free feature-rich PHP mailer",
+ "homepage": "http://swiftmailer.org",
+ "keywords": [
+ "email",
+ "mail",
+ "mailer"
+ ],
+ "time": "2016-12-29T10:02:40+00:00"
+ },
+ {
+ "name": "symfony/console",
+ "version": "v3.2.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/console.git",
+ "reference": "7a8405a9fc175f87fed8a3c40856b0d866d61936"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/console/zipball/7a8405a9fc175f87fed8a3c40856b0d866d61936",
+ "reference": "7a8405a9fc175f87fed8a3c40856b0d866d61936",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.9",
+ "symfony/debug": "~2.8|~3.0",
+ "symfony/polyfill-mbstring": "~1.0"
+ },
+ "require-dev": {
+ "psr/log": "~1.0",
+ "symfony/event-dispatcher": "~2.8|~3.0",
+ "symfony/filesystem": "~2.8|~3.0",
+ "symfony/process": "~2.8|~3.0"
+ },
+ "suggest": {
+ "psr/log": "For using the console logger",
+ "symfony/event-dispatcher": "",
+ "symfony/filesystem": "",
+ "symfony/process": ""
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.2-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Console\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Console Component",
+ "homepage": "https://symfony.com",
+ "time": "2017-02-06T12:04:21+00:00"
+ },
+ {
+ "name": "symfony/css-selector",
+ "version": "v3.2.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/css-selector.git",
+ "reference": "f0e628f04fc055c934b3211cfabdb1c59eefbfaa"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/css-selector/zipball/f0e628f04fc055c934b3211cfabdb1c59eefbfaa",
+ "reference": "f0e628f04fc055c934b3211cfabdb1c59eefbfaa",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.9"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.2-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\CssSelector\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jean-François Simon",
+ "email": "jeanfrancois.simon@sensiolabs.com"
+ },
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony CssSelector Component",
+ "homepage": "https://symfony.com",
+ "time": "2017-01-02T20:32:22+00:00"
+ },
+ {
+ "name": "symfony/debug",
+ "version": "v3.2.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/debug.git",
+ "reference": "b4d9818f127c60ce21ed62c395da7df868dc8477"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/debug/zipball/b4d9818f127c60ce21ed62c395da7df868dc8477",
+ "reference": "b4d9818f127c60ce21ed62c395da7df868dc8477",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.9",
+ "psr/log": "~1.0"
+ },
+ "conflict": {
+ "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
+ },
+ "require-dev": {
+ "symfony/class-loader": "~2.8|~3.0",
+ "symfony/http-kernel": "~2.8|~3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.2-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Debug\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Debug Component",
+ "homepage": "https://symfony.com",
+ "time": "2017-01-28T02:37:08+00:00"
+ },
+ {
+ "name": "symfony/event-dispatcher",
+ "version": "v3.2.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/event-dispatcher.git",
+ "reference": "9137eb3a3328e413212826d63eeeb0217836e2b6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9137eb3a3328e413212826d63eeeb0217836e2b6",
+ "reference": "9137eb3a3328e413212826d63eeeb0217836e2b6",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.9"
+ },
+ "require-dev": {
+ "psr/log": "~1.0",
+ "symfony/config": "~2.8|~3.0",
+ "symfony/dependency-injection": "~2.8|~3.0",
+ "symfony/expression-language": "~2.8|~3.0",
+ "symfony/stopwatch": "~2.8|~3.0"
+ },
+ "suggest": {
+ "symfony/dependency-injection": "",
+ "symfony/http-kernel": ""
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.2-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\EventDispatcher\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony EventDispatcher Component",
+ "homepage": "https://symfony.com",
+ "time": "2017-01-02T20:32:22+00:00"
+ },
+ {
+ "name": "symfony/finder",
+ "version": "v3.2.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/finder.git",
+ "reference": "8c71141cae8e2957946b403cc71a67213c0380d6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/8c71141cae8e2957946b403cc71a67213c0380d6",
+ "reference": "8c71141cae8e2957946b403cc71a67213c0380d6",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.9"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.2-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Finder\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Finder Component",
+ "homepage": "https://symfony.com",
+ "time": "2017-01-02T20:32:22+00:00"
+ },
+ {
+ "name": "symfony/http-foundation",
+ "version": "v3.4.38",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/http-foundation.git",
+ "reference": "4d440be93adcfd5e4ee0bdc7acd1c3260625728f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/http-foundation/zipball/4d440be93adcfd5e4ee0bdc7acd1c3260625728f",
+ "reference": "4d440be93adcfd5e4ee0bdc7acd1c3260625728f",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.5.9|>=7.0.8",
+ "symfony/polyfill-mbstring": "~1.1",
+ "symfony/polyfill-php70": "~1.6"
+ },
+ "require-dev": {
+ "symfony/expression-language": "~2.8|~3.0|~4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.4-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\HttpFoundation\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony HttpFoundation Component",
+ "homepage": "https://symfony.com",
+ "time": "2020-02-06T08:18:51+00:00"
+ },
+ {
+ "name": "symfony/http-kernel",
+ "version": "v3.2.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/http-kernel.git",
+ "reference": "96443239baf674b143604fb87cb27cb01672ab77"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/http-kernel/zipball/96443239baf674b143604fb87cb27cb01672ab77",
+ "reference": "96443239baf674b143604fb87cb27cb01672ab77",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.9",
+ "psr/log": "~1.0",
+ "symfony/debug": "~2.8|~3.0",
+ "symfony/event-dispatcher": "~2.8|~3.0",
+ "symfony/http-foundation": "~2.8.13|~3.1.6|~3.2"
+ },
+ "conflict": {
+ "symfony/config": "<2.8"
+ },
+ "require-dev": {
+ "symfony/browser-kit": "~2.8|~3.0",
+ "symfony/class-loader": "~2.8|~3.0",
+ "symfony/config": "~2.8|~3.0",
+ "symfony/console": "~2.8|~3.0",
+ "symfony/css-selector": "~2.8|~3.0",
+ "symfony/dependency-injection": "~2.8|~3.0",
+ "symfony/dom-crawler": "~2.8|~3.0",
+ "symfony/expression-language": "~2.8|~3.0",
+ "symfony/finder": "~2.8|~3.0",
+ "symfony/process": "~2.8|~3.0",
+ "symfony/routing": "~2.8|~3.0",
+ "symfony/stopwatch": "~2.8|~3.0",
+ "symfony/templating": "~2.8|~3.0",
+ "symfony/translation": "~2.8|~3.0",
+ "symfony/var-dumper": "~3.2"
+ },
+ "suggest": {
+ "symfony/browser-kit": "",
+ "symfony/class-loader": "",
+ "symfony/config": "",
+ "symfony/console": "",
+ "symfony/dependency-injection": "",
+ "symfony/finder": "",
+ "symfony/var-dumper": ""
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.2-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\HttpKernel\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony HttpKernel Component",
+ "homepage": "https://symfony.com",
+ "time": "2017-02-06T13:15:19+00:00"
+ },
+ {
+ "name": "symfony/polyfill-mbstring",
+ "version": "v1.14.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-mbstring.git",
+ "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2",
+ "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "suggest": {
+ "ext-mbstring": "For best performance"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.14-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Mbstring\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill for the Mbstring extension",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "mbstring",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "time": "2020-01-13T11:15:53+00:00"
+ },
+ {
+ "name": "symfony/polyfill-php56",
+ "version": "v1.10.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-php56.git",
+ "reference": "ff208829fe1aa48ab9af356992bb7199fed551af"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/ff208829fe1aa48ab9af356992bb7199fed551af",
+ "reference": "ff208829fe1aa48ab9af356992bb7199fed551af",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "symfony/polyfill-util": "~1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.9-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Php56\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "time": "2018-09-21T06:26:08+00:00"
+ },
+ {
+ "name": "symfony/polyfill-php70",
+ "version": "v1.14.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-php70.git",
+ "reference": "419c4940024c30ccc033650373a1fe13890d3255"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/419c4940024c30ccc033650373a1fe13890d3255",
+ "reference": "419c4940024c30ccc033650373a1fe13890d3255",
+ "shasum": ""
+ },
+ "require": {
+ "paragonie/random_compat": "~1.0|~2.0|~9.99",
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.14-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Php70\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ],
+ "classmap": [
+ "Resources/stubs"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "time": "2020-01-13T11:15:53+00:00"
+ },
+ {
+ "name": "symfony/polyfill-util",
+ "version": "v1.10.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-util.git",
+ "reference": "3b58903eae668d348a7126f999b0da0f2f93611c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/3b58903eae668d348a7126f999b0da0f2f93611c",
+ "reference": "3b58903eae668d348a7126f999b0da0f2f93611c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.9-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Util\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony utilities for portability of PHP codes",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compat",
+ "compatibility",
+ "polyfill",
+ "shim"
+ ],
+ "time": "2018-09-30T16:36:12+00:00"
+ },
+ {
+ "name": "symfony/process",
+ "version": "v3.2.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/process.git",
+ "reference": "32646a7cf53f3956c76dcb5c82555224ae321858"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/process/zipball/32646a7cf53f3956c76dcb5c82555224ae321858",
+ "reference": "32646a7cf53f3956c76dcb5c82555224ae321858",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.9"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.2-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Process\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Process Component",
+ "homepage": "https://symfony.com",
+ "time": "2017-02-03T12:11:38+00:00"
+ },
+ {
+ "name": "symfony/routing",
+ "version": "v3.2.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/routing.git",
+ "reference": "af464432c177dbcdbb32295113b7627500331f2d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/routing/zipball/af464432c177dbcdbb32295113b7627500331f2d",
+ "reference": "af464432c177dbcdbb32295113b7627500331f2d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.9"
+ },
+ "conflict": {
+ "symfony/config": "<2.8"
+ },
+ "require-dev": {
+ "doctrine/annotations": "~1.0",
+ "doctrine/common": "~2.2",
+ "psr/log": "~1.0",
+ "symfony/config": "~2.8|~3.0",
+ "symfony/expression-language": "~2.8|~3.0",
+ "symfony/http-foundation": "~2.8|~3.0",
+ "symfony/yaml": "~2.8|~3.0"
+ },
+ "suggest": {
+ "doctrine/annotations": "For using the annotation loader",
+ "symfony/config": "For using the all-in-one router or any loader",
+ "symfony/dependency-injection": "For loading routes from a service",
+ "symfony/expression-language": "For using expression matching",
+ "symfony/http-foundation": "For using a Symfony Request object",
+ "symfony/yaml": "For using the YAML loader"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.2-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Routing\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Routing Component",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "router",
+ "routing",
+ "uri",
+ "url"
+ ],
+ "time": "2017-01-28T02:37:08+00:00"
+ },
+ {
+ "name": "symfony/translation",
+ "version": "v3.2.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/translation.git",
+ "reference": "ca032cc56976d88b85e7386b17020bc6dc95dbc5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/translation/zipball/ca032cc56976d88b85e7386b17020bc6dc95dbc5",
+ "reference": "ca032cc56976d88b85e7386b17020bc6dc95dbc5",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.9",
+ "symfony/polyfill-mbstring": "~1.0"
+ },
+ "conflict": {
+ "symfony/config": "<2.8"
+ },
+ "require-dev": {
+ "psr/log": "~1.0",
+ "symfony/config": "~2.8|~3.0",
+ "symfony/intl": "~2.8|~3.0",
+ "symfony/yaml": "~2.8|~3.0"
+ },
+ "suggest": {
+ "psr/log": "To use logging capability in translator",
+ "symfony/config": "",
+ "symfony/yaml": ""
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.2-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Translation\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Translation Component",
+ "homepage": "https://symfony.com",
+ "time": "2017-01-21T17:06:35+00:00"
+ },
+ {
+ "name": "symfony/var-dumper",
+ "version": "v3.2.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/var-dumper.git",
+ "reference": "5bb4435a03a4f05c211f4a9a8ee2756965924511"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/var-dumper/zipball/5bb4435a03a4f05c211f4a9a8ee2756965924511",
+ "reference": "5bb4435a03a4f05c211f4a9a8ee2756965924511",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.9",
+ "symfony/polyfill-mbstring": "~1.0"
+ },
+ "require-dev": {
+ "twig/twig": "~1.20|~2.0"
+ },
+ "suggest": {
+ "ext-symfony_debug": ""
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.2-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "Resources/functions/dump.php"
+ ],
+ "psr-4": {
+ "Symfony\\Component\\VarDumper\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony mechanism for exploring and dumping PHP variables",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "debug",
+ "dump"
+ ],
+ "time": "2017-01-24T12:58:58+00:00"
+ },
+ {
+ "name": "tijsverkoyen/css-to-inline-styles",
+ "version": "2.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git",
+ "reference": "ab03919dfd85a74ae0372f8baf9f3c7d5c03b04b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/ab03919dfd85a74ae0372f8baf9f3c7d5c03b04b",
+ "reference": "ab03919dfd85a74ae0372f8baf9f3c7d5c03b04b",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.5 || ^7",
+ "symfony/css-selector": "^2.7|~3.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.8|5.1.*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "TijsVerkoyen\\CssToInlineStyles\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Tijs Verkoyen",
+ "email": "css_to_inline_styles@verkoyen.eu",
+ "role": "Developer"
+ }
+ ],
+ "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.",
+ "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles",
+ "time": "2016-09-20T12:50:39+00:00"
+ },
+ {
+ "name": "vlucas/phpdotenv",
+ "version": "v2.4.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/vlucas/phpdotenv.git",
+ "reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c",
+ "reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.9"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.8 || ^5.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.4-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Dotenv\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause-Attribution"
+ ],
+ "authors": [
+ {
+ "name": "Vance Lucas",
+ "email": "vance@vancelucas.com",
+ "homepage": "http://www.vancelucas.com"
+ }
+ ],
+ "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.",
+ "keywords": [
+ "dotenv",
+ "env",
+ "environment"
+ ],
+ "time": "2016-09-01T10:05:43+00:00"
+ },
+ {
+ "name": "zendframework/zend-escaper",
+ "version": "2.6.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/zendframework/zend-escaper.git",
+ "reference": "31d8aafae982f9568287cb4dce987e6aff8fd074"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/31d8aafae982f9568287cb4dce987e6aff8fd074",
+ "reference": "31d8aafae982f9568287cb4dce987e6aff8fd074",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.6 || ^7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2",
+ "zendframework/zend-coding-standard": "~1.0.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.6.x-dev",
+ "dev-develop": "2.7.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Zend\\Escaper\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "description": "Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs",
+ "keywords": [
+ "ZendFramework",
+ "escaper",
+ "zf"
+ ],
+ "abandoned": "laminas/laminas-escaper",
+ "time": "2018-04-25T15:48:53+00:00"
+ }
+ ],
+ "packages-dev": [
+ {
+ "name": "doctrine/instantiator",
+ "version": "1.0.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/instantiator.git",
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
+ "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3,<8.0-DEV"
+ },
+ "require-dev": {
+ "athletic/athletic": "~0.1.8",
+ "ext-pdo": "*",
+ "ext-phar": "*",
+ "phpunit/phpunit": "~4.0",
+ "squizlabs/php_codesniffer": "~2.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Marco Pivetta",
+ "email": "ocramius@gmail.com",
+ "homepage": "http://ocramius.github.com/"
+ }
+ ],
+ "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
+ "homepage": "https://github.com/doctrine/instantiator",
+ "keywords": [
+ "constructor",
+ "instantiate"
+ ],
+ "time": "2015-06-14T21:17:01+00:00"
+ },
+ {
+ "name": "fzaninotto/faker",
+ "version": "v1.6.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/fzaninotto/Faker.git",
+ "reference": "44f9a286a04b80c76a4e5fb7aad8bb539b920123"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/44f9a286a04b80c76a4e5fb7aad8bb539b920123",
+ "reference": "44f9a286a04b80c76a4e5fb7aad8bb539b920123",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.3.3|^7.0"
+ },
+ "require-dev": {
+ "ext-intl": "*",
+ "phpunit/phpunit": "~4.0",
+ "squizlabs/php_codesniffer": "~1.5"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": []
+ },
+ "autoload": {
+ "psr-4": {
+ "Faker\\": "src/Faker/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "François Zaninotto"
+ }
+ ],
+ "description": "Faker is a PHP library that generates fake data for you.",
+ "keywords": [
+ "data",
+ "faker",
+ "fixtures"
+ ],
+ "time": "2016-04-29T12:21:54+00:00"
+ },
+ {
+ "name": "hamcrest/hamcrest-php",
+ "version": "v1.2.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/hamcrest/hamcrest-php.git",
+ "reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/b37020aa976fa52d3de9aa904aa2522dc518f79c",
+ "reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.2"
+ },
+ "replace": {
+ "cordoval/hamcrest-php": "*",
+ "davedevelopment/hamcrest-php": "*",
+ "kodova/hamcrest-php": "*"
+ },
+ "require-dev": {
+ "phpunit/php-file-iterator": "1.3.3",
+ "satooshi/php-coveralls": "dev-master"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "hamcrest"
+ ],
+ "files": [
+ "hamcrest/Hamcrest.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD"
+ ],
+ "description": "This is the PHP port of Hamcrest Matchers",
+ "keywords": [
+ "test"
+ ],
+ "time": "2015-05-11T14:41:42+00:00"
+ },
+ {
+ "name": "mockery/mockery",
+ "version": "0.9.7",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/mockery/mockery.git",
+ "reference": "4de7969f4664da3cef1ccd83866c9f59378c3371"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/mockery/mockery/zipball/4de7969f4664da3cef1ccd83866c9f59378c3371",
+ "reference": "4de7969f4664da3cef1ccd83866c9f59378c3371",
+ "shasum": ""
+ },
+ "require": {
+ "hamcrest/hamcrest-php": "~1.1",
+ "lib-pcre": ">=7.0",
+ "php": ">=5.3.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "0.9.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Mockery": "library/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Pádraic Brady",
+ "email": "padraic.brady@gmail.com",
+ "homepage": "http://blog.astrumfutura.com"
+ },
+ {
+ "name": "Dave Marshall",
+ "email": "dave.marshall@atstsolutions.co.uk",
+ "homepage": "http://davedevelopment.co.uk"
+ }
+ ],
+ "description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.",
+ "homepage": "http://github.com/padraic/mockery",
+ "keywords": [
+ "BDD",
+ "TDD",
+ "library",
+ "mock",
+ "mock objects",
+ "mockery",
+ "stub",
+ "test",
+ "test double",
+ "testing"
+ ],
+ "time": "2016-12-19T14:50:55+00:00"
+ },
+ {
+ "name": "myclabs/deep-copy",
+ "version": "1.6.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/myclabs/DeepCopy.git",
+ "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/5a5a9fc8025a08d8919be87d6884d5a92520cefe",
+ "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "doctrine/collections": "1.*",
+ "phpunit/phpunit": "~4.1"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "DeepCopy\\": "src/DeepCopy/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Create deep copies (clones) of your objects",
+ "homepage": "https://github.com/myclabs/DeepCopy",
+ "keywords": [
+ "clone",
+ "copy",
+ "duplicate",
+ "object",
+ "object graph"
+ ],
+ "time": "2017-01-26T22:05:40+00:00"
+ },
+ {
+ "name": "phpdocumentor/reflection-common",
+ "version": "1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/ReflectionCommon.git",
+ "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
+ "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.6"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "phpDocumentor\\Reflection\\": [
+ "src"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jaap van Otterdijk",
+ "email": "opensource@ijaap.nl"
+ }
+ ],
+ "description": "Common reflection classes used by phpdocumentor to reflect the code structure",
+ "homepage": "http://www.phpdoc.org",
+ "keywords": [
+ "FQSEN",
+ "phpDocumentor",
+ "phpdoc",
+ "reflection",
+ "static analysis"
+ ],
+ "time": "2015-12-27T11:43:31+00:00"
+ },
+ {
+ "name": "phpdocumentor/reflection-docblock",
+ "version": "3.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
+ "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e",
+ "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5",
+ "phpdocumentor/reflection-common": "^1.0@dev",
+ "phpdocumentor/type-resolver": "^0.2.0",
+ "webmozart/assert": "^1.0"
+ },
+ "require-dev": {
+ "mockery/mockery": "^0.9.4",
+ "phpunit/phpunit": "^4.4"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "phpDocumentor\\Reflection\\": [
+ "src/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mike van Riel",
+ "email": "me@mikevanriel.com"
+ }
+ ],
+ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
+ "time": "2016-09-30T07:12:33+00:00"
+ },
+ {
+ "name": "phpdocumentor/type-resolver",
+ "version": "0.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/TypeResolver.git",
+ "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb",
+ "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5",
+ "phpdocumentor/reflection-common": "^1.0"
+ },
+ "require-dev": {
+ "mockery/mockery": "^0.9.4",
+ "phpunit/phpunit": "^5.2||^4.8.24"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "phpDocumentor\\Reflection\\": [
+ "src/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mike van Riel",
+ "email": "me@mikevanriel.com"
+ }
+ ],
+ "time": "2016-11-25T06:54:22+00:00"
+ },
+ {
+ "name": "phpspec/prophecy",
+ "version": "v1.6.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpspec/prophecy.git",
+ "reference": "6c52c2722f8460122f96f86346600e1077ce22cb"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb",
+ "reference": "6c52c2722f8460122f96f86346600e1077ce22cb",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/instantiator": "^1.0.2",
+ "php": "^5.3|^7.0",
+ "phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
+ "sebastian/comparator": "^1.1",
+ "sebastian/recursion-context": "^1.0|^2.0"
+ },
+ "require-dev": {
+ "phpspec/phpspec": "^2.0",
+ "phpunit/phpunit": "^4.8 || ^5.6.5"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.6.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Prophecy\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Konstantin Kudryashov",
+ "email": "ever.zet@gmail.com",
+ "homepage": "http://everzet.com"
+ },
+ {
+ "name": "Marcello Duarte",
+ "email": "marcello.duarte@gmail.com"
+ }
+ ],
+ "description": "Highly opinionated mocking framework for PHP 5.3+",
+ "homepage": "https://github.com/phpspec/prophecy",
+ "keywords": [
+ "Double",
+ "Dummy",
+ "fake",
+ "mock",
+ "spy",
+ "stub"
+ ],
+ "time": "2016-11-21T14:58:47+00:00"
+ },
+ {
+ "name": "phpunit/php-code-coverage",
+ "version": "4.0.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
+ "reference": "c19cfc7cbb0e9338d8c469c7eedecc2a428b0971"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c19cfc7cbb0e9338d8c469c7eedecc2a428b0971",
+ "reference": "c19cfc7cbb0e9338d8c469c7eedecc2a428b0971",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.6 || ^7.0",
+ "phpunit/php-file-iterator": "~1.3",
+ "phpunit/php-text-template": "~1.2",
+ "phpunit/php-token-stream": "^1.4.2",
+ "sebastian/code-unit-reverse-lookup": "~1.0",
+ "sebastian/environment": "^1.3.2 || ^2.0",
+ "sebastian/version": "~1.0|~2.0"
+ },
+ "require-dev": {
+ "ext-xdebug": ">=2.1.4",
+ "phpunit/phpunit": "^5.4"
+ },
+ "suggest": {
+ "ext-dom": "*",
+ "ext-xdebug": ">=2.4.0",
+ "ext-xmlwriter": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
+ "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
+ "keywords": [
+ "coverage",
+ "testing",
+ "xunit"
+ ],
+ "time": "2017-01-20T15:06:43+00:00"
+ },
+ {
+ "name": "phpunit/php-file-iterator",
+ "version": "1.4.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
+ "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
+ "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "FilterIterator implementation that filters files based on a list of suffixes.",
+ "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
+ "keywords": [
+ "filesystem",
+ "iterator"
+ ],
+ "time": "2016-10-03T07:40:28+00:00"
+ },
+ {
+ "name": "phpunit/php-text-template",
+ "version": "1.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-text-template.git",
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Simple template engine.",
+ "homepage": "https://github.com/sebastianbergmann/php-text-template/",
+ "keywords": [
+ "template"
+ ],
+ "time": "2015-06-21T13:50:34+00:00"
+ },
+ {
+ "name": "phpunit/php-timer",
+ "version": "1.0.8",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-timer.git",
+ "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260",
+ "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4|~5"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Utility class for timing",
+ "homepage": "https://github.com/sebastianbergmann/php-timer/",
+ "keywords": [
+ "timer"
+ ],
+ "time": "2016-05-12T18:03:57+00:00"
+ },
+ {
+ "name": "phpunit/php-token-stream",
+ "version": "1.4.9",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-token-stream.git",
+ "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b",
+ "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b",
+ "shasum": ""
+ },
+ "require": {
+ "ext-tokenizer": "*",
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Wrapper around PHP's tokenizer extension.",
+ "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
+ "keywords": [
+ "tokenizer"
+ ],
+ "time": "2016-11-15T14:06:22+00:00"
+ },
+ {
+ "name": "phpunit/phpunit",
+ "version": "5.7.11",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/phpunit.git",
+ "reference": "a6ad2472daba76b0689042b7709f86d4f06bcaab"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a6ad2472daba76b0689042b7709f86d4f06bcaab",
+ "reference": "a6ad2472daba76b0689042b7709f86d4f06bcaab",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-json": "*",
+ "ext-libxml": "*",
+ "ext-mbstring": "*",
+ "ext-xml": "*",
+ "myclabs/deep-copy": "~1.3",
+ "php": "^5.6 || ^7.0",
+ "phpspec/prophecy": "^1.6.2",
+ "phpunit/php-code-coverage": "^4.0.4",
+ "phpunit/php-file-iterator": "~1.4",
+ "phpunit/php-text-template": "~1.2",
+ "phpunit/php-timer": "^1.0.6",
+ "phpunit/phpunit-mock-objects": "^3.2",
+ "sebastian/comparator": "^1.2.4",
+ "sebastian/diff": "~1.2",
+ "sebastian/environment": "^1.3.4 || ^2.0",
+ "sebastian/exporter": "~2.0",
+ "sebastian/global-state": "^1.1",
+ "sebastian/object-enumerator": "~2.0",
+ "sebastian/resource-operations": "~1.0",
+ "sebastian/version": "~1.0|~2.0",
+ "symfony/yaml": "~2.1|~3.0"
+ },
+ "conflict": {
+ "phpdocumentor/reflection-docblock": "3.0.2"
+ },
+ "require-dev": {
+ "ext-pdo": "*"
+ },
+ "suggest": {
+ "ext-xdebug": "*",
+ "phpunit/php-invoker": "~1.1"
+ },
+ "bin": [
+ "phpunit"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "5.7.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "The PHP Unit Testing framework.",
+ "homepage": "https://phpunit.de/",
+ "keywords": [
+ "phpunit",
+ "testing",
+ "xunit"
+ ],
+ "time": "2017-02-05T15:31:31+00:00"
+ },
+ {
+ "name": "phpunit/phpunit-mock-objects",
+ "version": "3.4.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
+ "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3ab72b65b39b491e0c011e2e09bb2206c2aa8e24",
+ "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/instantiator": "^1.0.2",
+ "php": "^5.6 || ^7.0",
+ "phpunit/php-text-template": "^1.2",
+ "sebastian/exporter": "^1.2 || ^2.0"
+ },
+ "conflict": {
+ "phpunit/phpunit": "<5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^5.4"
+ },
+ "suggest": {
+ "ext-soap": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.2.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sb@sebastian-bergmann.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Mock Object library for PHPUnit",
+ "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
+ "keywords": [
+ "mock",
+ "xunit"
+ ],
+ "abandoned": true,
+ "time": "2016-12-08T20:27:08+00:00"
+ },
+ {
+ "name": "sebastian/code-unit-reverse-lookup",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
+ "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe",
+ "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.6"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~5"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Looks up which function or method a line of code belongs to",
+ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
+ "time": "2016-02-13T06:45:14+00:00"
+ },
+ {
+ "name": "sebastian/comparator",
+ "version": "1.2.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/comparator.git",
+ "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
+ "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "sebastian/diff": "~1.2",
+ "sebastian/exporter": "~1.2 || ~2.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.2.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@2bepublished.at"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides the functionality to compare PHP values for equality",
+ "homepage": "http://www.github.com/sebastianbergmann/comparator",
+ "keywords": [
+ "comparator",
+ "compare",
+ "equality"
+ ],
+ "time": "2017-01-29T09:50:25+00:00"
+ },
+ {
+ "name": "sebastian/diff",
+ "version": "1.4.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/diff.git",
+ "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
+ "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.8"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Kore Nordmann",
+ "email": "mail@kore-nordmann.de"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Diff implementation",
+ "homepage": "https://github.com/sebastianbergmann/diff",
+ "keywords": [
+ "diff"
+ ],
+ "time": "2015-12-08T07:14:41+00:00"
+ },
+ {
+ "name": "sebastian/environment",
+ "version": "2.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/environment.git",
+ "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac",
+ "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.6 || ^7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^5.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides functionality to handle HHVM/PHP environments",
+ "homepage": "http://www.github.com/sebastianbergmann/environment",
+ "keywords": [
+ "Xdebug",
+ "environment",
+ "hhvm"
+ ],
+ "time": "2016-11-26T07:53:53+00:00"
+ },
+ {
+ "name": "sebastian/exporter",
+ "version": "2.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/exporter.git",
+ "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4",
+ "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "sebastian/recursion-context": "~2.0"
+ },
+ "require-dev": {
+ "ext-mbstring": "*",
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@2bepublished.at"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ }
+ ],
+ "description": "Provides the functionality to export PHP variables for visualization",
+ "homepage": "http://www.github.com/sebastianbergmann/exporter",
+ "keywords": [
+ "export",
+ "exporter"
+ ],
+ "time": "2016-11-19T08:54:04+00:00"
+ },
+ {
+ "name": "sebastian/global-state",
+ "version": "1.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/global-state.git",
+ "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
+ "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
+ "suggest": {
+ "ext-uopz": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Snapshotting of global state",
+ "homepage": "http://www.github.com/sebastianbergmann/global-state",
+ "keywords": [
+ "global state"
+ ],
+ "time": "2015-10-12T03:26:01+00:00"
+ },
+ {
+ "name": "sebastian/object-enumerator",
+ "version": "2.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/object-enumerator.git",
+ "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35",
+ "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.6",
+ "sebastian/recursion-context": "~2.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~5"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Traverses array structures and object graphs to enumerate all referenced objects",
+ "homepage": "https://github.com/sebastianbergmann/object-enumerator/",
+ "time": "2016-11-19T07:35:10+00:00"
+ },
+ {
+ "name": "sebastian/recursion-context",
+ "version": "2.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/recursion-context.git",
+ "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a",
+ "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ }
+ ],
+ "description": "Provides functionality to recursively process PHP variables",
+ "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
+ "time": "2016-11-19T07:33:16+00:00"
+ },
+ {
+ "name": "sebastian/resource-operations",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/resource-operations.git",
+ "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
+ "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.6.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides a list of PHP built-in functions that operate on resources",
+ "homepage": "https://www.github.com/sebastianbergmann/resource-operations",
+ "time": "2015-07-28T20:34:47+00:00"
+ },
+ {
+ "name": "sebastian/version",
+ "version": "2.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/version.git",
+ "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019",
+ "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.6"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that helps with managing the version number of Git-hosted PHP projects",
+ "homepage": "https://github.com/sebastianbergmann/version",
+ "time": "2016-10-03T07:35:21+00:00"
+ },
+ {
+ "name": "symfony/yaml",
+ "version": "v3.2.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/yaml.git",
+ "reference": "e1718c6bf57e1efbb8793ada951584b2ab27775b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/e1718c6bf57e1efbb8793ada951584b2ab27775b",
+ "reference": "e1718c6bf57e1efbb8793ada951584b2ab27775b",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.9"
+ },
+ "require-dev": {
+ "symfony/console": "~2.8|~3.0"
+ },
+ "suggest": {
+ "symfony/console": "For validating YAML files using the lint command"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.2-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Yaml\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Yaml Component",
+ "homepage": "https://symfony.com",
+ "time": "2017-01-21T17:06:35+00:00"
+ },
+ {
+ "name": "webmozart/assert",
+ "version": "1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/webmozart/assert.git",
+ "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f",
+ "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.3.3 || ^7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.6",
+ "sebastian/version": "^1.0.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Webmozart\\Assert\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@gmail.com"
+ }
+ ],
+ "description": "Assertions to validate method input/output with nice error messages.",
+ "keywords": [
+ "assert",
+ "check",
+ "validate"
+ ],
+ "time": "2016-11-23T20:04:58+00:00"
+ }
+ ],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": {
+ "php": ">=5.6.4"
+ },
+ "platform-dev": []
+}
diff --git a/laravel54/package.json b/laravel54/package.json
new file mode 100644
index 0000000..e20b9d9
--- /dev/null
+++ b/laravel54/package.json
@@ -0,0 +1,17 @@
+{
+ "private": true,
+ "scripts": {
+ "dev": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
+ "watch": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
+ "hot": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
+ "production": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
+ },
+ "devDependencies": {
+ "axios": "^0.19.2",
+ "bootstrap-sass": "^3.3.7",
+ "jquery": "^3.1.0",
+ "laravel-mix": "^0.6.0",
+ "lodash": "^4.16.2",
+ "vue": "^2.0.1"
+ }
+}
diff --git a/nosql/mongodb.txt b/nosql/mongodb.txt
new file mode 100644
index 0000000..ec08a02
--- /dev/null
+++ b/nosql/mongodb.txt
@@ -0,0 +1,24 @@
+很多人比较关心 MongoDB 的适用场景,也有用户在话题里分享了自己的业务场景,比如
+
+案例1
+
+用在应用服务器的日志记录,查找起来比文本灵活,导出也很方便。也是给应用练手,从外围系统开始使用MongoDB。
+用在一些第三方信息的获取或者抓取,因为MongoDB的schema-less,所有格式灵活,不用为了各种格式不一样的信息专门设计统一的格式,极大的减少开发的工作。
+
+案例2
+
+mongodb之前有用过,主要用来存储一些监控数据,No schema 对开发人员来说,真的很方便,增加字段不用改表结构,而且学习成本极低。
+
+案例3
+
+使用MongoDB做了O2O快递应用,·将送快递骑手、快递商家的信息(包含位置信息)存储在 MongoDB,然后通过 MongoDB 的地理位置查询,
+这样很方便的实现了查找附近的商家、骑手等功能,使得快递骑手能就近接单,目前在使用MongoDB 上没遇到啥大的问题,官网的文档比较详细,很给力。
+
+MongoDB做lbs
+
+对于我们的需求,在MongoDB只需一个命令即可得到所需要的结果:
+
+db.runCommand( { geoNear: "places", near: [ 121.4905, 31.2646 ], num:100 })
+查询结果默认将会由近到远排序,而且查询结果也包含目标点对象、距离目标点的距离等信息。
+
+由于geoNear是MongoDB原生支持的查询函数,所以性能上也做到了高度的优化,完全可以应付生产环境的压力。
\ No newline at end of file
diff --git a/php/.idea/misc.xml b/php/.idea/misc.xml
new file mode 100644
index 0000000..28a804d
--- /dev/null
+++ b/php/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/php/.idea/modules.xml b/php/.idea/modules.xml
new file mode 100644
index 0000000..2047c36
--- /dev/null
+++ b/php/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/php/.idea/php.iml b/php/.idea/php.iml
new file mode 100644
index 0000000..c956989
--- /dev/null
+++ b/php/.idea/php.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/php/.idea/vcs.xml b/php/.idea/vcs.xml
new file mode 100644
index 0000000..6c0b863
--- /dev/null
+++ b/php/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/php/.idea/workspace.xml b/php/.idea/workspace.xml
new file mode 100644
index 0000000..e0f01b4
--- /dev/null
+++ b/php/.idea/workspace.xml
@@ -0,0 +1,249 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ add
+
+
+
+
+
+
+
+
+
+
+
+ true
+ DEFINITION_ORDER
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1542589903604
+
+
+ 1542589903604
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/php/Container.php b/php/Container.php
new file mode 100644
index 0000000..deac433
--- /dev/null
+++ b/php/Container.php
@@ -0,0 +1,341 @@
+doSomething();
+ echo __METHOD__, '|';
+ }
+}
+
+class Foo
+{
+ public function doSomething()
+ {
+ $bar = new Bar();
+ $bar->doSomething();
+ echo __METHOD__;
+ }
+}
+
+$foo = new Foo();
+$foo->doSomething(); //Bim::doSomething|Bar::doSomething|Foo::doSomething
+
+/**
+ * Class Bim
+ * 使用依赖注入的思路是应用程序用到Foo类,Foo类需要Bar类,Bar类需要Bim类,
+ * 那么先创建Bim类,再创建Bar类并把Bim注入,再创建Foo类,并把Bar类注入,
+ * 再调用Foo方法,Foo调用Bar方法,接着做些其它工作。
+ */
+
+// 代码【2】
+class Bim
+{
+ public function doSomething()
+ {
+ echo __METHOD__, '|';
+ }
+}
+
+class Bar
+{
+ private $bim;
+
+ public function __construct(Bim $bim)
+ {
+ $this->bim = $bim;
+ }
+
+ public function doSomething()
+ {
+ $this->bim->doSomething();
+ echo __METHOD__, '|';
+ }
+}
+
+class Foo
+{
+ private $bar;
+
+ public function __construct(Bar $bar)
+ {
+ $this->bar = $bar;
+ }
+
+ public function doSomething()
+ {
+ $this->bar->doSomething();
+ echo __METHOD__;
+ }
+}
+
+$foo = new Foo(new Bar(new Bim()));
+$foo->doSomething(); // Bim::doSomething|Bar::doSomething|Foo::doSomething
+
+/**
+ * 使用依赖注入容器后的思路是应用程序需要到Foo类,
+ * 就从容器内取得Foo类,容器创建Bim类,再创建Bar类并把Bim注入,
+ * 再创建Foo类,并把Bar注入,应用程序调用Foo方法,Foo调用Bar方法,接着做些其它工作.
+ */
+class Container
+{
+ private $s = array();
+
+ function __set($k, $c)
+ {
+ $this->s[$k] = $c;
+ }
+
+ function __get($k)
+ {
+ return $this->s[$k]($this);
+ }
+}
+$c = new Container();
+
+$c->bim = function () {
+ return new Bim();
+};
+$c->bar = function ($c) {
+ return new Bar($c->bim);
+};
+$c->foo = function ($c) {
+ return new Foo($c->bar);
+};
+
+// 从容器中取得Foo
+$foo = $c->foo;
+$foo->doSomething(); // Bim::doSomething|Bar::doSomething|Foo::doSomething
+
+/**
+ * 此段代码使用了后期静态绑定
+ *
+ */
+
+class IoC
+{
+ protected static $registry = [];
+
+ public static function bind($name, Callable $resolver)
+ {
+ static::$registry[$name] = $resolver;
+ }
+
+ public static function make($name)
+ {
+ if (isset(static::$registry[$name])) {
+ $resolver = static::$registry[$name];
+ return $resolver();
+ }
+ throw new Exception('Alias does not exist in the IoC registry.');
+ }
+}
+
+IoC::bind('bim', function () {
+ return new Bim();
+});
+IoC::bind('bar', function () {
+ return new Bar(IoC::make('bim'));
+});
+IoC::bind('foo', function () {
+ return new Foo(IoC::make('bar'));
+});
+
+
+// 从容器中取得Foo
+$foo = IoC::make('foo');
+$foo->doSomething(); // Bim::doSomething|Bar::doSomething|Foo::doSomething
+
+/**
+ * 依赖注入容器 (dependency injection container) 高级功能
+ * 自动绑定(Autowiring)或 自动解析(Automatic Resolution)
+ * 注释解析器(Annotations)
+ * 延迟注入(Lazy injection)
+ */
+class Bim
+{
+ public function doSomething()
+ {
+ echo __METHOD__, '|';
+ }
+}
+
+class Bar
+{
+ private $bim;
+
+ public function __construct(Bim $bim)
+ {
+ $this->bim = $bim;
+ }
+
+ public function doSomething()
+ {
+ $this->bim->doSomething();
+ echo __METHOD__, '|';
+ }
+}
+
+class Foo
+{
+ private $bar;
+
+ public function __construct(Bar $bar)
+ {
+ $this->bar = $bar;
+ }
+
+ public function doSomething()
+ {
+ $this->bar->doSomething();
+ echo __METHOD__;
+ }
+}
+
+class Container
+{
+ private $s = array();
+
+ public function __set($k, $c)
+ {
+ $this->s[$k] = $c;
+ }
+
+ public function __get($k)
+ {
+ // return $this->s[$k]($this);
+ return $this->build($this->s[$k]);
+ }
+
+ /**
+ * 自动绑定(Autowiring)自动解析(Automatic Resolution)
+ *
+ * @param string $className
+ * @return object
+ * @throws Exception
+ */
+ public function build($className)
+ {
+ // 如果是匿名函数(Anonymous functions),也叫闭包函数(closures)
+ if ($className instanceof Closure) {
+ // 执行闭包函数,并将结果
+ return $className($this);
+ }
+
+ /** @var ReflectionClass $reflector */
+ $reflector = new ReflectionClass($className);
+
+ // 检查类是否可实例化, 排除抽象类abstract和对象接口interface
+ if (!$reflector->isInstantiable()) {
+ throw new Exception("Can't instantiate this.");
+ }
+
+ /** @var ReflectionMethod $constructor 获取类的构造函数 */
+ $constructor = $reflector->getConstructor();
+
+ // 若无构造函数,直接实例化并返回
+ if (is_null($constructor)) {
+ return new $className;
+ }
+
+ // 取构造函数参数,通过 ReflectionParameter 数组返回参数列表
+ $parameters = $constructor->getParameters();
+
+ // 递归解析构造函数的参数
+ $dependencies = $this->getDependencies($parameters);
+
+ // 创建一个类的新实例,给出的参数将传递到类的构造函数。
+ return $reflector->newInstanceArgs($dependencies);
+ }
+
+ /**
+ * @param array $parameters
+ * @return array
+ * @throws Exception
+ */
+ public function getDependencies($parameters)
+ {
+ $dependencies = [];
+
+ /** @var ReflectionParameter $parameter */
+ foreach ($parameters as $parameter) {
+ /** @var ReflectionClass $dependency */
+ $dependency = $parameter->getClass();
+
+ if (is_null($dependency)) {
+ // 是变量,有默认值则设置默认值
+ $dependencies[] = $this->resolveNonClass($parameter);
+ } else {
+ // 是一个类,递归解析
+ $dependencies[] = $this->build($dependency->name);
+ }
+ }
+
+ return $dependencies;
+ }
+
+ /**
+ * @param ReflectionParameter $parameter
+ * @return mixed
+ * @throws Exception
+ */
+ public function resolveNonClass($parameter)
+ {
+ // 有默认值则返回默认值
+ if ($parameter->isDefaultValueAvailable()) {
+ return $parameter->getDefaultValue();
+ }
+
+ throw new Exception('I have no idea what to do here.');
+ }
+}
+
+// ----
+$c = new Container();
+$c->bar = 'Bar';
+$c->foo = function ($c) {
+ return new Foo($c->bar);
+};
+// 从容器中取得Foo
+$foo = $c->foo;
+$foo->doSomething(); // Bim::doSomething|Bar::doSomething|Foo::doSomething
+
+// ----
+$di = new Container();
+
+$di->foo = 'Foo';
+
+/** @var Foo $foo */
+$foo = $di->foo;
+
+var_dump($foo);
+/*
+Foo#10 (1) {
+ private $bar =>
+ class Bar#14 (1) {
+ private $bim =>
+ class Bim#16 (0) {
+ }
+ }
+}
+*/
+
+$foo->doSomething(); // Bim::doSomething|Bar::doSomething|Foo::doSomething
\ No newline at end of file
diff --git a/php/Factory.php b/php/Factory.php
new file mode 100644
index 0000000..8a8f4d1
--- /dev/null
+++ b/php/Factory.php
@@ -0,0 +1,50 @@
+
+ */
+interface people {
+ function jiehun();
+}
+class man implements people{
+ function jiehun() {
+ echo '送玫瑰,送戒指!
';
+ }
+}
+
+class women implements people {
+ function jiehun() {
+ echo '穿婚纱!
';
+ }
+}
+
+interface createMan { // 注意了,这里是简单工厂本质区别所在,将对象的创建抽象成一个接口。
+ function create();
+
+}
+class FactoryMan implements createMan{
+ function create() {
+ return new man;
+ }
+}
+class FactoryWomen implements createMan {
+ function create() {
+ return new women;
+ }
+}
+
+class Client {
+ // 工厂方法
+ function test() {
+ $Factory = new FactoryMan;
+ $man = $Factory->create();
+ $man->jiehun();
+
+ $Factory = new FactoryWomen;
+ $man = $Factory->create();
+ $man->jiehun();
+ }
+}
+
+$f = new Client;
+$f->test();
\ No newline at end of file
diff --git a/php/Hash.php b/php/Hash.php
new file mode 100644
index 0000000..c50bfbb
--- /dev/null
+++ b/php/Hash.php
@@ -0,0 +1,66 @@
+buckets = new SplFixedArray($this->size)
+ }
+
+ private function hashfunc($key) {
+ $strlen = strlen($key);
+ $hashval = 0;
+ for ($i=0; $i < $strlen ; $i++) {
+ $hashval += ord($key{$i});
+ # code...
+ }
+
+ return $hashval % $this->size;
+ }
+
+ public function insert($key, $val) {
+ $index = $this->hashfunc($key);
+ //在链表头部插入新的key,value
+ if(isset($this->buckets[$index])) {
+ //将原来的key,value放到nextNode变量中
+ $newNode = new HashNode($key, $value, $this->buckets[$index]);
+ } else {
+ $newNode = new HashNode($key,$value,NULL);
+ }
+ //将新key,value放到当前节点,
+ $this->buckets[ $index ] = $newNode;
+ }
+
+ public function find($key) {
+ $index = $this->hashfunc($key);
+ $current = $this->buckets[$index];
+ while(isset($current)) {
+ if($current -> $key == $key) {
+ return $current->value;
+ }
+ $current = $current->nextNode;
+ }
+ return $this->buckets[ $index ];
+ }
+}
+
+class HashNode {
+ public $key;
+ public $value;
+ public $nextNode;
+ public function __construct($key, $value, $nextNode = NULL) {
+ $this->key = $key;
+ $this->value = $value;
+ $this->nextNode = $nextNode;
+ }
+}
+
+
+$ht = new HashTable();
+$ht->insert('key1','value1');
+$ht->insert('key2','value2');
+
+echo $ht->find('key1');
+echo $ht->find('key2');
+
+
diff --git a/php/ManagerEncode.php b/php/ManagerEncode.php
new file mode 100644
index 0000000..d71031b
--- /dev/null
+++ b/php/ManagerEncode.php
@@ -0,0 +1,30 @@
+a = $a;
+ $this->b = $b;
+ }
+ public function test() {
+ echo 'This is the method test of class BAR
';
+ echo '$this->a=', $this->a, ', $this->b=', $this->b;
+ }
+}
+
+/**
+ * 利用反射来实例化对象
+ */
+$class = new ReflectionClass('FOO');
+$foo = $class->newInstance(); //或者是$foo = $class->newInstanceArgs();
+$foo->test();
+
+$class = new ReflectionClass('BAR');
+$bar = $class->newInstanceArgs(array(55, 65));
+$bar->test();
+
+/**
+ * @return object
+ * @throws ReflectionException
+ * 通用利用反射来实例化对象的函数
+ */
+function newInstance() {
+ $arguments = func_get_args();//获取传递过来的参数
+ $className = array_shift($arguments);
+ $class = new ReflectionClass($className);
+ return $class->newInstanceArgs($arguments);
+}
+$foo = newInstance('FOO');
+$foo->test();
+//输出结果:
+//This is the method test of class FOO
+
+$bar = newInstance('BAR', 3, 5);
+$bar->test();
+//输出结果:
+//This is the method test of class BAR
+//$this->a=3, $this->b=5
+
+/**
+ * Class INSTANCE
+ * 使用魔术方法来实现类的实例化
+ */
+class INSTANCE {
+ function __call($className, $arguments) {
+ $class = new ReflectionClass($className);
+ return $class->newInstanceArgs($arguments);
+ }
+}
+$inst = new INSTANCE();
+$foo = $inst->foo();
+$foo->test();
+//输出结果:
+//This is the method test of class FOO
+
+$bar = $inst->bar('arg1', 'arg2');
+$bar->test();
+//输出结果:
+//This is the method test of class BAR
+//$this->a=3, $this->b=5
+
+
+
diff --git a/php/app_php_demo.php b/php/app_php_demo.php
new file mode 100644
index 0000000..8101b2c
--- /dev/null
+++ b/php/app_php_demo.php
@@ -0,0 +1,66 @@
+$val){
+ $sb .= $key . '=' . $val . '&';
+}
+$sb .= $xpp_key;
+$server_sign = md5($sb);
+
+//将sign与客户端传过来的sign进行比对,如不一样则可能是中途被篡改参数,服务器拒绝此次请求
+if($server_sign !== $client_sign){
+ echo json_encode(array('code'=>'invalid request'));
+ exit;
+}
+
+//将sign与session中的sign对比,如果一样,则为重复提交,服务器拒绝此次请求
+if($server_sign == $_SESSION['last_sign']){
+ echo json_encode(array('code'=>'Repeated requests'));
+ exit();
+}
+
+//此次的sign存入session
+$_SESSION['last_sign'] = $server_sign;
+
+//执行路由cmd(base64解析后),将参数带到该方法中
+$cmd = base64_decode($param['cmd']);
+list($__controller,$__action) = explode('-' , $cmd);
+
+// 设置请求参数
+unset($param['cmd']);
+unset($param['timestamp']);
+foreach($param as $key => $val){
+ $_REQUEST[$key] = $val;
+}
\ No newline at end of file
diff --git a/php/array_reduce.php b/php/array_reduce.php
new file mode 100644
index 0000000..8d80e1a
--- /dev/null
+++ b/php/array_reduce.php
@@ -0,0 +1,48 @@
+';
+ $next();
+ }
+ }
+
+ class VerfiyAuth implements Milldeware {
+
+ public static function handle(Closure $next)
+ {
+ echo '验证是否登录
';
+ $next();
+ }
+ }
+
+ class SetCookie implements Milldeware {
+ public static function handle(Closure $next)
+ {
+ $next();
+ echo '设置cookie信息!';
+ }
+ }
+
+ $handle = function() {
+ echo '当前要执行的程序!';
+ };
+
+ $pipe_arr = [
+ 'VerfiyCsrfToekn',
+ 'VerfiyAuth',
+ 'SetCookie',
+ ];
+
+ $callback = array_reduce($pipe_arr,function($stack,$pipe) {
+ return function() use($stack,$pipe){
+ return $pipe::handle($stack);
+ };
+ },$handle);
+
+ call_user_func($callback);
\ No newline at end of file
diff --git a/php/autoloader.php b/php/autoloader.php
new file mode 100644
index 0000000..c9ef4fd
--- /dev/null
+++ b/php/autoloader.php
@@ -0,0 +1,41 @@
+
+
diff --git a/php/design/IFactory.php b/php/design/IFactory.php
new file mode 100644
index 0000000..a236157
--- /dev/null
+++ b/php/design/IFactory.php
@@ -0,0 +1,45 @@
+CreateOperation();
+$operation->setA(10);
+$operation->setB(10);
+echo $operation->getResult()."\n";
\ No newline at end of file
diff --git a/php/design/absFactory.php b/php/design/absFactory.php
new file mode 100644
index 0000000..63dfde0
--- /dev/null
+++ b/php/design/absFactory.php
@@ -0,0 +1,166 @@
+id = $id;
+ }
+
+ public function getId($id)
+ {
+ return $this->id;
+ }
+ private $name = null;
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ public function getName()
+ {
+ return $this->name;
+ }
+}
+
+class Department
+{
+ private $id = null;
+ public function setId($id)
+ {
+ $this->id = $id;
+ }
+
+ public function getId($id)
+ {
+ return $this->id;
+ }
+ private $name = null;
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ public function getName()
+ {
+ return $this->name;
+ }
+}
+
+interface IUser
+{
+ public function insert(User $user);
+ public function getUser($id);
+}
+
+class SqlserverUser implements IUser
+{
+ public function insert(User $user)
+ {
+ echo "往sql Server中 插入数据";
+ }
+
+ public function getUser($id)
+ {
+ echo "根据id获取sql Server数据";
+ }
+}
+
+class AcessUser implements IUser
+{
+ public function insert(User $user)
+ {
+ echo "往Access 插入数据";
+ }
+ public function getUser($id)
+ {
+ echo "根据id 获取access中的数据";
+ }
+}
+
+interface IDepartment
+{
+ public function insert(Department $user);
+ public function getDepartment($id);
+}
+
+class SqlserverDepartment implements IDepartment
+{
+ public function insert(Department $department)
+ {
+ echo "往SQL Server中的Department表添加一条记录\n";
+ }
+
+ public function getDepartment($id)
+ {
+ echo "根据id得到SQL Server中Department表一条记录\n";
+ }
+}
+
+class AcessDepartment implements IDepartment
+{
+ public function insert(Department $department)
+ {
+ echo "往Acess Server中的Department表添加一条记录\n";
+ }
+
+ public function getDepartment($id)
+ {
+ echo "根据id得到Acess Server中Department表一条记录\n";
+ }
+}
+
+// interface IFactory
+// {
+// public function CreateUser();
+// public function CreateDepartment();
+// }
+
+// class SqlserverFactory implements IFactory
+// {
+// public function CreateUser()
+// {
+// return new SqlserverUser();
+// }
+
+// public function CreateDepartment()
+// {
+// return new SqlserverDeparetment();
+// }
+// }
+class DataBase
+{
+ const DB = 'Sqlserver';
+
+ public static function CreateUser()
+ {
+ $class = static::DB.'User';
+ return new $class();
+ }
+
+ public static function CreateDepartment()
+ {
+ $class = static::DB.'Department';
+ return new $class();
+ }
+}
+
+$user = new User();
+$iu = DataBase::CreateUser();
+$iu->insert($user);
+$iu->getUser(1);
+
+
+
diff --git a/php/design/adaptor.php b/php/design/adaptor.php
new file mode 100644
index 0000000..a65aa59
--- /dev/null
+++ b/php/design/adaptor.php
@@ -0,0 +1,174 @@
+name = $name;
+ }
+
+ abstract public function Attack();
+ abstract public function Defense();
+}
+
+class Forwards extends Player
+{
+ public function Attack()
+ {
+ echo '前锋:'.$this->name.'进攻\n';
+ }
+
+ public function Defense()
+ {
+ echo "前锋:".$this->name." 防守\n";
+ }
+
+}
+
+class Center extends Player
+{
+ public function Attack()
+ {
+ echo '中锋:'.$this->name.'进攻\n';
+ }
+
+ public function Defense()
+ {
+ echo "中锋:".$this->name." 防守\n";
+ }
+
+}
+
+
+class ForeignCenter
+{
+ private $name;
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ public function getName()
+ {
+ return $this->name;
+ }
+ public function 进攻()
+ {
+ echo "外籍中锋:".$this->name." 进攻\n";
+ }
+
+ public function 防守()
+ {
+ echo "外籍中锋:".$this->name." 防守\n";
+ }
+}
+
+class Translator extends Player
+{
+ private $foreignCenter;
+
+ function __construct($name)
+ {
+ $this->foreignCenter = new ForeignCenter;
+ $this->foreignCenter->setName($name);
+ }
+ public function Attack()
+ {
+ $this->foreignCenter->进攻();
+ }
+
+ public function Defense()
+ {
+ $this->foreignCenter->防守();
+ }
+}
+
+$forwards = new Forwards('bde');
+$forwards->Attack();
+$forwards->Defense();
+
+$translator = new Translator('姚明');
+$translator->Attack();
+$translator->Defense();
+
+interface MediaPlayer
+{
+ public function play($audiotype,$filename);
+}
+
+interface AdvancedMediaPlayer
+{
+ public function playVlc($filename);
+ public function playMp4($filename);
+}
+
+class VlcPlayer implements AdvancedMediaPlayer
+{
+ public function playVlc($filename)
+ {
+ echo 'playing vlc'.$filename;
+ }
+
+ public function playMp4($filename)
+ {
+
+ }
+}
+
+class Mp4Player implements AdvancedMediaPlayer
+{
+ public function playVlc($filename)
+ {
+
+ }
+
+ public function playMp4($filename)
+ {
+ echo 'playing mp4'.$filename;
+ }
+}
+
+class MediaAdapter implements MediaPlayer
+{
+ private $advancedMusicPlayer;
+ public function __construct($audioType)
+ {
+ if($audioType == 'vlc') {
+ $this->advancedMusicPlayer = new VlcPlayer();
+ } elseif($audioType =='mp4') {
+ $this->advancedMusicPlayer = new Mp4Player();
+ }
+ }
+
+ public function play($audiotype, $filename)
+ {
+ if($audiotype == 'vlc') {
+ $this->advancedMusicPlayer->playVlc($filename);
+ }
+ if($audiotype == 'mp4') {
+ $this->advancedMusicPlayer->playMp4($filename);
+ }
+
+ }
+}
+
+interface SDCard
+{
+ public function readSD();
+ public function writeSD($msg);
+}
+
+class SDCardImpl implements SDCard
+{
+ private $msg;
+ public function readSD()
+ {
+ return $this->msg;
+ }
+
+ public function writeSD($msg)
+ {
+ $this->msg = $msg;
+ }
+}
diff --git a/php/design/component.php b/php/design/component.php
new file mode 100644
index 0000000..cac78c2
--- /dev/null
+++ b/php/design/component.php
@@ -0,0 +1,83 @@
+name = $name;
+ }
+
+ abstract public function add(Component $c);
+ abstract public function remove(Component $c);
+ abstract public function display($depth);
+
+}
+
+class Leaf extends Component
+{
+ public function add(Component $c)
+ {
+ echo "can not add a left";
+ }
+
+ public function remove(\Component $c)
+ {
+ echo "can not remove a leaf";
+ }
+
+ public function display($depth)
+ {
+ echo str_repeat('-', $depth).$this->name."\n";
+ }
+}
+
+class Composite extends Component
+{
+ private $children = [];
+
+ public function add(Component $c)
+ {
+ array_push($this->children, $c);
+ }
+
+ public function remove(Component $c)
+ {
+ foreach($this->children as $key => $value){
+ if($c == $value) {
+ unset($this->children[$key]);
+ }
+ }
+ }
+
+ public function display($depth)
+ {
+ echo str_repeat('-', $depth).$this->name."\n";
+ foreach($this->children as $component) {
+ $component->display($depth + 2);
+ }
+ }
+}
+$root = new Composite('root');
+$root->add(new Leaf("Leaf A"));
+$root->add(new Leaf("Leaf B"));
+
+$comp = new Composite("Composite X");
+$comp->add(new Leaf("Leaf XA"));
+$comp->add(new Leaf("Leaf XB"));
+
+$root->add($comp);
+
+$comp2 = new Composite("Composite X");
+$comp2->add(new Leaf("Leaf XA"));
+$comp2->add(new Leaf("Leaf XB"));
+
+$comp->add($comp2);
+
+$root->add(new Leaf("Leaf C"));
+
+$leaf = new Leaf("Leaf D");
+$root->add($leaf);
+$root->remove($leaf);
+
+$root->display(1);
\ No newline at end of file
diff --git a/php/design/facade.php b/php/design/facade.php
new file mode 100644
index 0000000..49e7165
--- /dev/null
+++ b/php/design/facade.php
@@ -0,0 +1,66 @@
+systemOne = new SubSystemOne();
+ $this->systemTwo = new SubSystemTwo();
+ $this->systemThree = new SubSystemThree();
+ $this->systemFour = new SubSystemFour();
+ }
+
+ public function methodA()
+ {
+ echo "方法A() ---\n";
+ $this->systemOne->methodOne();
+ $this->systemThree->methodThree();
+ }
+
+ public function methodB()
+ {
+ echo "方法B() ---\n";
+ $this->systemTwo->methodTwo();
+ $this->systemFour->methodFour();
+ }
+}
+
+$facade = new Facade();
+$facade->methodA();
+$facade->methodB();
\ No newline at end of file
diff --git a/php/design/factory.php b/php/design/factory.php
new file mode 100644
index 0000000..7de5c8b
--- /dev/null
+++ b/php/design/factory.php
@@ -0,0 +1,96 @@
+a = $a;
+ }
+
+ public function setB($b)
+ {
+ $this->b = $b;
+ }
+
+ public function getResult()
+ {
+ $result = 0;
+ return $result;
+ }
+}
+
+/**
+ * Add
+ */
+class OperationAdd extends Operation
+{
+ public function getResult()
+ {
+ return $this->a + $this->b;
+ }
+}
+
+/**
+ * Mul
+ */
+class OperationMul extends Operation
+{
+ public function getResult()
+ {
+ return $this->a * $this->b;
+ }
+}
+
+/**
+ * Sub
+ */
+class OperationSub extends Operation
+{
+ public function getResult()
+ {
+ return $this->a - $this->b;
+ }
+}
+
+/**
+ * Div
+ */
+class OperationDiv extends Operation
+{
+ public function getResult()
+ {
+ return $this->a / $this->b;
+ }
+}
+
+class OperationFactory
+{
+ public static function createOperation($operation)
+ {
+ switch ($operation) {
+ case '+':
+ $oper = new OperationAdd();
+ break;
+ case '-':
+ $oper = new OperationSub();
+ break;
+ case '/':
+ $oper = new OperationDiv();
+ break;
+ case '*':
+ $oper = new OperationMul();
+ break;
+ }
+ return $oper;
+ }
+}
+// 客户端代码
+$operation = OperationFactory::createOperation('+');
+$operation->setA(1);
+$operation->setA(2);
+echo $operation->getResult()."\n";
\ No newline at end of file
diff --git a/php/design/iterator.php b/php/design/iterator.php
new file mode 100644
index 0000000..3e2a95a
--- /dev/null
+++ b/php/design/iterator.php
@@ -0,0 +1,50 @@
+aggregate = $aggregate;
+ }
+
+ public function first()
+ {
+ return $this->aggregate[0];
+ }
+
+ public function next()
+ {
+ $ret = null;
+ $this->current++;
+ if($this->current < count($this->aggregate))
+ {
+ $ret = $this->aggregate[$this->current];
+ }
+ return $ret;
+ }
+
+ public function isDone()
+ {
+ return $this->current >= count($this->aggregate);
+ }
+
+ public function currentItem()
+ {
+ return $this->aggregate[$this->current];
+ }
+}
\ No newline at end of file
diff --git a/php/design/mouseAbstarctFactory.php b/php/design/mouseAbstarctFactory.php
new file mode 100644
index 0000000..ab789f7
--- /dev/null
+++ b/php/design/mouseAbstarctFactory.php
@@ -0,0 +1,95 @@
+createKeybo()->sayHi();
+$dellFactory->createMouse()->sayHi();
+//惠普工厂生产鼠标键盘
+$hpFactory = new HpFactory();
+$hpFactory->createKeybo()->sayHi();
+$hpFactory->createMouse()->sayHi();
\ No newline at end of file
diff --git a/php/design/mouseFactory.php b/php/design/mouseFactory.php
new file mode 100644
index 0000000..7fce611
--- /dev/null
+++ b/php/design/mouseFactory.php
@@ -0,0 +1,59 @@
+createMouse()->sayHi();
+//惠普工厂生产惠普鼠标
+$hpFactory = new HpFactory();
+$hpFactory->createMouse()->sayHi();
diff --git a/php/design/mousesimpleFactory.php b/php/design/mousesimpleFactory.php
new file mode 100644
index 0000000..1454dcf
--- /dev/null
+++ b/php/design/mousesimpleFactory.php
@@ -0,0 +1,53 @@
+sayHi();
+//惠普鼠标
+$hp = MouseFactory::createMouse(1);
+$hp->sayHi();
\ No newline at end of file
diff --git a/php/design/observer.php b/php/design/observer.php
new file mode 100644
index 0000000..305cfd4
--- /dev/null
+++ b/php/design/observer.php
@@ -0,0 +1,74 @@
+observers, $observer);
+ }
+
+ public function detatch($observer)
+ {
+ foreach($this->observers as $key => $value)
+ {
+ if($observer == $value) {
+ unset($this->observers[$key]);
+ }
+ }
+ }
+
+ public function notify()
+ {
+ foreach($this->observers as $observer)
+ {
+ $observer->update();
+ }
+ }
+}
+
+abstract class Observer
+{
+ abstract function update();
+}
+
+class ConcreteSubject extends Subject
+{
+ private $subjectState;
+ public function setState($state)
+ {
+ $this->subjectState = $state;
+ }
+
+ public function getState()
+ {
+ return $this->subjectState;
+ }
+}
+
+class ConcreteObserver extends Observer
+{
+ private $name;
+ private $subject;
+
+ function __construct(ConcreteSubject $subject, $name)
+ {
+ $this->subject = $subject;
+ $this->name = $name;
+ }
+
+ public function update()
+ {
+ echo "观察者".$this->name."".$this->subject->getState();
+ }
+}
+
+$s = new ConcreteSubject();
+$s->attach(new ConcreteObserver($s,'x'));
+$s->attach(new ConcreteObserver($s,'y'));
+$z = new ConcreteObserver($s,'z');
+$s->attach($z);
+$s->detatch($z);
+$s->setState('ABC');
+$s->notify();
+
diff --git a/php/design/singleton.php b/php/design/singleton.php
new file mode 100644
index 0000000..5bd8a36
--- /dev/null
+++ b/php/design/singleton.php
@@ -0,0 +1,19 @@
+';
+ }
+}
+class Iman implements people{
+ function jiehun() {
+ echo '我偷偷喜欢你
';
+ }
+}
+
+class Owomen implements people {
+ function jiehun() {
+ echo '我要穿婚纱!
';
+ }
+}
+
+class Iwomen implements people {
+ function jiehun() {
+ echo '我好害羞哦!!
';
+ }
+}
+
+interface createMan { // 注意了,这里是本质区别所在,将对象的创建抽象成一个接口。
+ function createOpen(); //分为 内敛的和外向的
+ function createIntro(); //内向
+
+}
+class FactoryMan implements createMan{
+ function createOpen() {
+ return new Oman;
+ }
+ function createIntro() {
+ return new Iman;
+ }
+}
+class FactoryWomen implements createMan {
+ function createOpen() {
+ return new Owomen;
+ }
+ function createIntro() {
+ return new Iwomen;
+ }
+}
+
+class Client {
+ // 抽象方法
+ function test() {
+ $Factory = new FactoryMan;
+ $man = $Factory->createOpen();
+ $man->jiehun();
+
+ $man = $Factory->createIntro();
+ $man->jiehun();
+
+
+ $Factory = new FactoryWomen;
+ $man = $Factory->createOpen();
+ $man->jiehun();
+
+ $man = $Factory->createIntro();
+ $man->jiehun();
+
+ }
+}
+
+$f = new Client;
+$f->test();
\ No newline at end of file
diff --git a/php/factory/Factory.php b/php/factory/Factory.php
new file mode 100644
index 0000000..8a8f4d1
--- /dev/null
+++ b/php/factory/Factory.php
@@ -0,0 +1,50 @@
+
+ */
+interface people {
+ function jiehun();
+}
+class man implements people{
+ function jiehun() {
+ echo '送玫瑰,送戒指!
';
+ }
+}
+
+class women implements people {
+ function jiehun() {
+ echo '穿婚纱!
';
+ }
+}
+
+interface createMan { // 注意了,这里是简单工厂本质区别所在,将对象的创建抽象成一个接口。
+ function create();
+
+}
+class FactoryMan implements createMan{
+ function create() {
+ return new man;
+ }
+}
+class FactoryWomen implements createMan {
+ function create() {
+ return new women;
+ }
+}
+
+class Client {
+ // 工厂方法
+ function test() {
+ $Factory = new FactoryMan;
+ $man = $Factory->create();
+ $man->jiehun();
+
+ $Factory = new FactoryWomen;
+ $man = $Factory->create();
+ $man->jiehun();
+ }
+}
+
+$f = new Client;
+$f->test();
\ No newline at end of file
diff --git a/php/factory/SimpleFactoty.php b/php/factory/SimpleFactoty.php
new file mode 100644
index 0000000..5f74e5f
--- /dev/null
+++ b/php/factory/SimpleFactoty.php
@@ -0,0 +1,35 @@
+';
+ }
+}
+
+class women implements people {
+ function jiehun() {
+ echo '穿婚纱!
';
+ }
+}
+
+class SimpleFactoty {
+ // 简单工厂里的静态方法
+ static function createMan() {
+ return new man;
+ }
+ static function createWomen() {
+ return new women;
+ }
+
+}
+
+$man = SimpleFactoty::createMan();
+$man->jiehun();
+$man = SimpleFactoty::createWomen();
+$man->jiehun();
\ No newline at end of file
diff --git a/php/factory/readme.md b/php/factory/readme.md
new file mode 100644
index 0000000..a9eb2f6
--- /dev/null
+++ b/php/factory/readme.md
@@ -0,0 +1,12 @@
+简单工厂模式:用来生产同一等级结构中的任意产品。对与增加新的产品,无能为力
+工厂模式 :用来生产同一等级结构中的固定产品。(支持增加任意产品)
+抽象工厂 :用来生产不同产品族的全部产品。(对于增加新的产品,无能为力;支持增加产品族)
+以上三种工厂 方法在等级结构和产品族这两个方向上的支持程度不同。所以要根据情况考虑应该使用哪种方法
+适用范围:
+简单工厂模式:
+工厂类负责创建的对象较少,客户只知道传入工厂类的参数,对于如何创建对象不关心。
+工厂方法模式:
+当一个类不知道它所必须创建对象的类或一个类希望由子类来指定它所创建的对象时,当类将创建对象的职责委托给多个帮助子类中得某一个,并且你希望将哪一个帮助子类是代理者这一信息局部化的时候,可以使用工厂方法模式。
+抽象工厂模式:
+一个系统不应当依赖于产品类实例何如被创建,组合和表达的细节,这对于所有形态的工厂模式都是重要的。这个系统有多于一个的产品族,而系统只消费其 中某一产品族。同属于同一个产品族的产品是在一起使用的,这一约束必须在系统的设计中体现出来。系统提供一个产品类的库,所有的产品以同样的接口出现,从 而使客户端不依赖于实现。
+无论是简单工厂模式、工厂模式还是抽象工厂模式,它们本质上都是将不变的部分提取出来,将可变的部分留作接口,以达到最大程度上的复用。究竟用哪种设计模式更适合,这要根据具体的业务需求来决定
\ No newline at end of file
diff --git a/php/hook.php b/php/hook.php
new file mode 100644
index 0000000..31f8b4a
--- /dev/null
+++ b/php/hook.php
@@ -0,0 +1,153 @@
+监听已经注册了的所有插件,并实例化这些插件对象。
+
+2>注册所有插件。
+
+3>当钩子条件满足时,触发对应的对象方法。
+
+2.插件的功能实现:需要遵循我们(经理类定义)的规则,这个规则是插件机制所规定的,因插件机制的不同而不同。
+
+3.插件的触发:也就是钩子的触发条件。这是一小段代码,放置在你需要调用插件的地方,用于触发这个钩子。
+ */
+
+//首先是插件经理类PluginManager,这个类要放在全局引用里面,在所有需要用到插件的地方,优先加载。
+/**
+ *
+ * 插件机制的实现核心类
+
+ */
+class PluginManager
+{
+ /**
+ * 监听已注册的插件
+ *
+ * @access private
+ * @var array
+ */
+ private $_listeners = array();
+ /**
+ * 构造函数
+ *
+ * @access public
+ * @return void
+ */
+ public function __construct()
+ {
+ #这里$plugin数组包含我们获取已经由用户激活的插件信息
+ #为演示方便,我们假定$plugin中至少包含
+ #$plugin = array(
+ # 'name' => '插件名称',
+ # 'directory'=>'插件安装目录'
+ #);
+ $plugins = get_active_plugins();#这个函数请自行实现
+ if($plugins)
+ {
+ foreach($plugins as $plugin)
+ {//假定每个插件文件夹中包含一个actions.php文件,它是插件的具体实现
+ if (@file_exists(STPATH .'plugins/'.$plugin['directory'].'/actions.php'))
+ {
+ include_once(STPATH .'plugins/'.$plugin['directory'].'/actions.php');
+ $class = $plugin['name'].'_actions';
+ if (class_exists($class))
+ {
+ //初始化所有插件
+ new $class($this);
+ }
+ }
+ }
+ }
+ #此处做些日志记录方面的东西
+ }
+
+ /**
+ * 注册需要监听的插件方法(钩子)
+ *
+ * @param string $hook
+ * @param object $reference
+ * @param string $method
+ */
+ function register($hook, &$reference, $method)
+ {
+ //获取插件要实现的方法
+ $key = get_class($reference).'->'.$method;
+ //将插件的引用连同方法push进监听数组中
+ $this->_listeners[$hook][$key] = array(&$reference, $method);
+ #此处做些日志记录方面的东西
+ }
+ /**
+ * 触发一个钩子
+ *
+ * @param string $hook 钩子的名称
+ * @param mixed $data 钩子的入参
+ * @return mixed
+ */
+ function trigger($hook, $data='')
+ {
+ $result = '';
+ //查看要实现的钩子,是否在监听数组之中
+ if (isset($this->_listeners[$hook]) && is_array($this->_listeners[$hook]) && count($this->_listeners[$hook]) > 0)
+ {
+ // 循环调用开始
+ foreach ($this->_listeners[$hook] as $listener)
+ {
+ // 取出插件对象的引用和方法
+ $class =& $listener[0];
+ $method = $listener[1];
+ if(method_exists($class,$method))
+ {
+ // 动态调用插件的方法
+ $result .= $class->$method($data);
+ }
+ }
+ }
+ #此处做些日志记录方面的东西
+ return $result;
+ }
+}
+/**
+ * 接下来是一个简单插件的实现DEMO_actions。
+ * 这是一个简单的Hello World插件,用于输出一句话。
+ * 在实际情况中,say_hello可能包括对数据库的操作,或者是其他一些特定的逻辑。
+ */
+class DEMO_actions
+{
+ //解析函数的参数是pluginManager的引用
+ function __construct(&$pluginManager)
+ {
+ //注册这个插件
+ //第一个参数是钩子的名称
+ //第二个参数是pluginManager的引用
+ //第三个是插件所执行的方法
+ $pluginManager->register('demo', $this, 'say_hello');
+ }
+
+ function say_hello()
+ {
+ echo 'Hello World';
+ }
+}
+
+/**
+ * 再接下来就是插件的调用触发的地方,比如我要将say_hello放到我博客首页Index.php,
+ * 那么你在index.php中的某个位置写下:
+$pluginManager->trigger('demo','');
+
+第一个参数表示钩子的名字,第二个参数是插件对应方法的入口参数,由于这个例子中没有输入参数,所以为空。
+ */
+
+
diff --git a/php/hookDemo.php b/php/hookDemo.php
new file mode 100644
index 0000000..f8c1538
--- /dev/null
+++ b/php/hookDemo.php
@@ -0,0 +1,108 @@
+ $v) {
+
+ if ($v=='.' || $v=='..') {
+ unset($pluginList[$k]);
+ }
+ }
+ echo "简易后台管理
";
+ // 插件管理
+ foreach ($pluginList as $k => $v) {
+ // 获取配置项
+ $config=include './plugin/'.$v.'/config.php';
+ $word=$config['status']==1 ? '点击关闭' : '点击开启';
+ echo $config['title'].''.$word.'
';
+ }
+ echo '
';
+ // 输出插件内容
+ foreach ($pluginList as $k => $v) {
+ // 获取配置项
+ $config=include './plugin/'.$v.'/config.php';
+ if ($config['status']==1) {
+ include './plugin/'.$v.'/index.php';
+ // 运行插件
+ Hook::run($v);
+ }
+ }
+ // 前往网站首页
+ }
+}
+// 插件类
+class Hook{
+ // 注册添加插件
+ public static function add($name,$func){
+ $GLOBALS['hookList'][$name][]=$func;
+ }
+ // 执行插件
+ public static function run($name,$params=null){
+ foreach ($GLOBALS['hookList'][$name] as $k => $v) {
+ call_user_func($v,$params);
+ }
+ }
+}
+// 更改插件状态
+if (isset($_GET['change'])) {
+ // 获取到配置项
+ $config=include './plugin/plugin'.substr($_GET['change'],-1).'/config.php';
+ // 如果是开启 那就关闭 如果是关闭 则开启
+ $config['status']=$config['status']==1 ? 0: 1;
+ // 将更改后的配置项写入到文件中
+ $str="index();
+
+/**
+ * 无插件demo
+ */
+
+class Test{
+ public function index(){
+ $phone = '';
+ $email = '';
+ // 用户注册成功
+ if ('如果设置了发送短信') {
+ // 发送短信
+ sendSms($phone);
+ }
+
+ if ('如果设置了发送邮件') {
+ // 发送邮件
+ sendSms($email);
+ }
+
+ // 其他操作...
+
+ // 前往网站首页
+ }
+}
+/**
+ * 发送短信通知
+ * @param integer $phone 手机号
+ */
+function sendSMS($phone){
+ // 此处是发送短信的代码
+}
+/**
+ * 发送邮件通知
+ * @param string $email 邮箱地址
+ */
+function sendEmail($email){
+ // 此处是发送邮件的代码
+}
+
diff --git a/php/ioc/Container.php b/php/ioc/Container.php
new file mode 100644
index 0000000..deac433
--- /dev/null
+++ b/php/ioc/Container.php
@@ -0,0 +1,341 @@
+doSomething();
+ echo __METHOD__, '|';
+ }
+}
+
+class Foo
+{
+ public function doSomething()
+ {
+ $bar = new Bar();
+ $bar->doSomething();
+ echo __METHOD__;
+ }
+}
+
+$foo = new Foo();
+$foo->doSomething(); //Bim::doSomething|Bar::doSomething|Foo::doSomething
+
+/**
+ * Class Bim
+ * 使用依赖注入的思路是应用程序用到Foo类,Foo类需要Bar类,Bar类需要Bim类,
+ * 那么先创建Bim类,再创建Bar类并把Bim注入,再创建Foo类,并把Bar类注入,
+ * 再调用Foo方法,Foo调用Bar方法,接着做些其它工作。
+ */
+
+// 代码【2】
+class Bim
+{
+ public function doSomething()
+ {
+ echo __METHOD__, '|';
+ }
+}
+
+class Bar
+{
+ private $bim;
+
+ public function __construct(Bim $bim)
+ {
+ $this->bim = $bim;
+ }
+
+ public function doSomething()
+ {
+ $this->bim->doSomething();
+ echo __METHOD__, '|';
+ }
+}
+
+class Foo
+{
+ private $bar;
+
+ public function __construct(Bar $bar)
+ {
+ $this->bar = $bar;
+ }
+
+ public function doSomething()
+ {
+ $this->bar->doSomething();
+ echo __METHOD__;
+ }
+}
+
+$foo = new Foo(new Bar(new Bim()));
+$foo->doSomething(); // Bim::doSomething|Bar::doSomething|Foo::doSomething
+
+/**
+ * 使用依赖注入容器后的思路是应用程序需要到Foo类,
+ * 就从容器内取得Foo类,容器创建Bim类,再创建Bar类并把Bim注入,
+ * 再创建Foo类,并把Bar注入,应用程序调用Foo方法,Foo调用Bar方法,接着做些其它工作.
+ */
+class Container
+{
+ private $s = array();
+
+ function __set($k, $c)
+ {
+ $this->s[$k] = $c;
+ }
+
+ function __get($k)
+ {
+ return $this->s[$k]($this);
+ }
+}
+$c = new Container();
+
+$c->bim = function () {
+ return new Bim();
+};
+$c->bar = function ($c) {
+ return new Bar($c->bim);
+};
+$c->foo = function ($c) {
+ return new Foo($c->bar);
+};
+
+// 从容器中取得Foo
+$foo = $c->foo;
+$foo->doSomething(); // Bim::doSomething|Bar::doSomething|Foo::doSomething
+
+/**
+ * 此段代码使用了后期静态绑定
+ *
+ */
+
+class IoC
+{
+ protected static $registry = [];
+
+ public static function bind($name, Callable $resolver)
+ {
+ static::$registry[$name] = $resolver;
+ }
+
+ public static function make($name)
+ {
+ if (isset(static::$registry[$name])) {
+ $resolver = static::$registry[$name];
+ return $resolver();
+ }
+ throw new Exception('Alias does not exist in the IoC registry.');
+ }
+}
+
+IoC::bind('bim', function () {
+ return new Bim();
+});
+IoC::bind('bar', function () {
+ return new Bar(IoC::make('bim'));
+});
+IoC::bind('foo', function () {
+ return new Foo(IoC::make('bar'));
+});
+
+
+// 从容器中取得Foo
+$foo = IoC::make('foo');
+$foo->doSomething(); // Bim::doSomething|Bar::doSomething|Foo::doSomething
+
+/**
+ * 依赖注入容器 (dependency injection container) 高级功能
+ * 自动绑定(Autowiring)或 自动解析(Automatic Resolution)
+ * 注释解析器(Annotations)
+ * 延迟注入(Lazy injection)
+ */
+class Bim
+{
+ public function doSomething()
+ {
+ echo __METHOD__, '|';
+ }
+}
+
+class Bar
+{
+ private $bim;
+
+ public function __construct(Bim $bim)
+ {
+ $this->bim = $bim;
+ }
+
+ public function doSomething()
+ {
+ $this->bim->doSomething();
+ echo __METHOD__, '|';
+ }
+}
+
+class Foo
+{
+ private $bar;
+
+ public function __construct(Bar $bar)
+ {
+ $this->bar = $bar;
+ }
+
+ public function doSomething()
+ {
+ $this->bar->doSomething();
+ echo __METHOD__;
+ }
+}
+
+class Container
+{
+ private $s = array();
+
+ public function __set($k, $c)
+ {
+ $this->s[$k] = $c;
+ }
+
+ public function __get($k)
+ {
+ // return $this->s[$k]($this);
+ return $this->build($this->s[$k]);
+ }
+
+ /**
+ * 自动绑定(Autowiring)自动解析(Automatic Resolution)
+ *
+ * @param string $className
+ * @return object
+ * @throws Exception
+ */
+ public function build($className)
+ {
+ // 如果是匿名函数(Anonymous functions),也叫闭包函数(closures)
+ if ($className instanceof Closure) {
+ // 执行闭包函数,并将结果
+ return $className($this);
+ }
+
+ /** @var ReflectionClass $reflector */
+ $reflector = new ReflectionClass($className);
+
+ // 检查类是否可实例化, 排除抽象类abstract和对象接口interface
+ if (!$reflector->isInstantiable()) {
+ throw new Exception("Can't instantiate this.");
+ }
+
+ /** @var ReflectionMethod $constructor 获取类的构造函数 */
+ $constructor = $reflector->getConstructor();
+
+ // 若无构造函数,直接实例化并返回
+ if (is_null($constructor)) {
+ return new $className;
+ }
+
+ // 取构造函数参数,通过 ReflectionParameter 数组返回参数列表
+ $parameters = $constructor->getParameters();
+
+ // 递归解析构造函数的参数
+ $dependencies = $this->getDependencies($parameters);
+
+ // 创建一个类的新实例,给出的参数将传递到类的构造函数。
+ return $reflector->newInstanceArgs($dependencies);
+ }
+
+ /**
+ * @param array $parameters
+ * @return array
+ * @throws Exception
+ */
+ public function getDependencies($parameters)
+ {
+ $dependencies = [];
+
+ /** @var ReflectionParameter $parameter */
+ foreach ($parameters as $parameter) {
+ /** @var ReflectionClass $dependency */
+ $dependency = $parameter->getClass();
+
+ if (is_null($dependency)) {
+ // 是变量,有默认值则设置默认值
+ $dependencies[] = $this->resolveNonClass($parameter);
+ } else {
+ // 是一个类,递归解析
+ $dependencies[] = $this->build($dependency->name);
+ }
+ }
+
+ return $dependencies;
+ }
+
+ /**
+ * @param ReflectionParameter $parameter
+ * @return mixed
+ * @throws Exception
+ */
+ public function resolveNonClass($parameter)
+ {
+ // 有默认值则返回默认值
+ if ($parameter->isDefaultValueAvailable()) {
+ return $parameter->getDefaultValue();
+ }
+
+ throw new Exception('I have no idea what to do here.');
+ }
+}
+
+// ----
+$c = new Container();
+$c->bar = 'Bar';
+$c->foo = function ($c) {
+ return new Foo($c->bar);
+};
+// 从容器中取得Foo
+$foo = $c->foo;
+$foo->doSomething(); // Bim::doSomething|Bar::doSomething|Foo::doSomething
+
+// ----
+$di = new Container();
+
+$di->foo = 'Foo';
+
+/** @var Foo $foo */
+$foo = $di->foo;
+
+var_dump($foo);
+/*
+Foo#10 (1) {
+ private $bar =>
+ class Bar#14 (1) {
+ private $bim =>
+ class Bim#16 (0) {
+ }
+ }
+}
+*/
+
+$foo->doSomething(); // Bim::doSomething|Bar::doSomething|Foo::doSomething
\ No newline at end of file
diff --git a/php/ioc/mouseAbstarctFactory.php b/php/ioc/mouseAbstarctFactory.php
new file mode 100644
index 0000000..ab789f7
--- /dev/null
+++ b/php/ioc/mouseAbstarctFactory.php
@@ -0,0 +1,95 @@
+createKeybo()->sayHi();
+$dellFactory->createMouse()->sayHi();
+//惠普工厂生产鼠标键盘
+$hpFactory = new HpFactory();
+$hpFactory->createKeybo()->sayHi();
+$hpFactory->createMouse()->sayHi();
\ No newline at end of file
diff --git a/php/ioc/mouseFactory.php b/php/ioc/mouseFactory.php
new file mode 100644
index 0000000..7fce611
--- /dev/null
+++ b/php/ioc/mouseFactory.php
@@ -0,0 +1,59 @@
+createMouse()->sayHi();
+//惠普工厂生产惠普鼠标
+$hpFactory = new HpFactory();
+$hpFactory->createMouse()->sayHi();
diff --git a/php/ioc/mousesimpleFactory.php b/php/ioc/mousesimpleFactory.php
new file mode 100644
index 0000000..1454dcf
--- /dev/null
+++ b/php/ioc/mousesimpleFactory.php
@@ -0,0 +1,53 @@
+sayHi();
+//惠普鼠标
+$hp = MouseFactory::createMouse(1);
+$hp->sayHi();
\ No newline at end of file
diff --git a/php/ioc/superMan.php b/php/ioc/superMan.php
new file mode 100644
index 0000000..0c688aa
--- /dev/null
+++ b/php/ioc/superMan.php
@@ -0,0 +1,172 @@
+speed = $speed;
+ $this->holdtime = $holdtime;
+ }
+ //激活该技能
+ public function activate(array $target)//参数可以忽略 保留待用
+ {
+ echo '超人飞行开始';
+ }
+
+ //输出该类实例(就是对象实例 如:new Flight;) 显示信息
+ public function __toString()
+ {
+ return $this->skill.'速度:'.$this->speed.' 飞翔时间:'.$this->holdtime;
+ }
+}
+
+
+//射击能力
+class Shot{
+ protected $attack;//伤害
+ protected $range;//伤害范围
+ protected $skill = '射击技能=';//技能解说
+ public function __construct($attack = 0, $range = 0)
+ {
+ $this->attack = $attack;
+ $this->range = $range;
+ }
+
+ //激活技能
+ public function activate(array $target)
+ {
+ echo '超人射击开始';
+ }
+ public function __toString()
+ {
+
+ return $this->skill.'伤害:'.$this->attack.' 射击距离:'.$this->range;
+ }
+
+}
+
+//暴击能力
+class Force implements Ability
+{
+ protected $attack;//伤害
+ protected $strength;//力量
+ protected $range;//范围
+ protected $skill;//技能标签
+ public function __construct($attack = 0, $range = 0, $strength = 0)
+ {
+ $this->attack = $attack;
+ $this->range = $range;
+ $this->strength = $strength;
+ }
+
+ //激活暴击技能
+ public function activate(array $target)
+ {
+ echo '超人暴力攻击';
+ }
+
+ public function __toString()
+ {
+ $this->skill = '暴力能力=';
+ return $this->skill.'伤害:'.$this->attack.' 力量:'.$this->strength.' 范围'.$this->range;
+ }
+}
+
+//终极炸弹能力(扔炸弹)
+class UltraBomb implements ability
+{
+ protected $skill = '炸弹技能=';
+ protected $range;
+ protected $attack;
+
+ public function __construct($range = 0 , $attack = 0)
+ {
+ $this->range = $range;
+ $this->attack = $attack;
+
+ }
+ /**
+ * @Author shyn
+ * @DateTime 2017-12-20
+ * @param integer $bombRange [炸弹伤害范围]
+ * @param integer $attack [炸弹伤害程度]
+ * @return [type] [description]
+ * [使用炸弹]
+ */
+ public function throwBomb($range = 5, $attack = 10){
+
+ echo '炸弹范围'.$range.'米 伤害为:'.$attack;
+ }
+
+ public function activate(array $target)
+ {
+ echo '超人炸弹发射';
+ return $this;
+ }
+
+ public function __toString()
+ {
+ return $this->skill.'伤害:'.$this->attack.' 爆炸范围:'.$this->range;
+ }
+
+}
+
+
+//超人类
+class Superman
+{
+ public $power = [];//用来保存超人技能 超人会有多个技能所以用数组
+
+ public function __construct(){
+ //重点在这里!!! 在没涉及到工厂类的时候,我们使用最简单的 超人技能类的调用类实现 超人拥有超人技能
+ //优点:简单明了一看就懂
+ //缺点:
+ //1.当涉及多个超人技能我们就得一个一个在这里写 从维护方面来说不妥
+ //2.当涉及到多个超人的时候我们还得在写一个这样的超人类 麻烦不 当然麻烦
+ //3.好,我们用工厂类来解决这个麻烦
+ $this->power =array(
+ 'flight'=> new Flight(9, 10),//给超人添加飞行能力
+ 'force' => new Force(33, 19, 20)//给超人添加暴力攻击能力
+ );
+
+ }
+
+}
+
+$superman = new Superman();
+$superman->power['flight']->activate([]);//超人开始飞行
+echo'
';
+$superman->power['force']->activate([]);//超人开始飞行
+
+
+
diff --git a/php/ioc/superManContainer.php b/php/ioc/superManContainer.php
new file mode 100644
index 0000000..7c520f6
--- /dev/null
+++ b/php/ioc/superManContainer.php
@@ -0,0 +1,255 @@
+speed = $speed;
+ $this->holdtime = $holdtime;
+ }
+ //激活该技能
+ public function activate(array $target = [])//参数可以忽略 保留待用
+ {
+ echo '超人飞行开始';
+ }
+
+ //输出该类实例(就是对象实例 如:new Flight;) 显示信息
+ public function __toString()
+ {
+ return $this->skill.'速度:'.$this->speed.' 飞翔时间:'.$this->holdtime;
+ }
+}
+
+
+//射击能力
+class Shot{
+ protected $attack;//伤害
+ protected $range;//伤害范围
+ protected $skill = '射击技能=';//技能解说
+ public function __construct($attack = 0, $range = 0)
+ {
+ $this->attack = $attack;
+ $this->range = $range;
+ }
+
+ //激活技能
+ public function activate(array $target = [])
+ {
+ echo '超人射击开始';
+ }
+ public function __toString()
+ {
+
+ return $this->skill.'伤害:'.$this->attack.' 射击距离:'.$this->range;
+ }
+
+}
+
+//暴击能力
+class Force implements Ability
+{
+ protected $attack;//伤害
+ protected $strength;//力量
+ protected $range;//范围
+ protected $skill;//技能标签
+ public function __construct($attack = 0, $range = 0, $strength = 0)
+ {
+ $this->attack = $attack;
+ $this->range = $range;
+ $this->strength = $strength;
+ }
+
+ //激活暴击技能
+ public function activate(array $target = [])
+ {
+ echo '超人暴力攻击';
+ }
+
+ public function __toString()
+ {
+ $this->skill = '暴力能力=';
+ return $this->skill.'伤害:'.$this->attack.' 力量:'.$this->strength.' 范围'.$this->range;
+ }
+}
+
+//终极炸弹能力(扔炸弹)
+class UltraBomb implements ability
+{
+ protected $skill = '炸弹技能=';
+ protected $range;
+ protected $attack;
+
+ public function __construct($range = 0 , $attack = 0)
+ {
+ $this->range = $range;
+ $this->attack = $attack;
+
+ }
+ /**
+ * @Author shyn
+ * @DateTime 2017-12-20
+ * @param integer $bombRange [炸弹伤害范围]
+ * @param integer $attack [炸弹伤害程度]
+ * @return [type] [description]
+ * [使用炸弹]
+ */
+ public function throwBomb($range = 5, $attack = 10){
+
+ echo '炸弹范围'.$range.'米 伤害为:'.$attack;
+ }
+
+ public function activate(array $target = [])
+ {
+ echo '超人炸弹发射';
+ return $this;
+ }
+
+ public function __toString()
+ {
+ return $this->skill.'伤害:'.$this->attack.' 爆炸范围:'.$this->range;
+ }
+
+}
+//超人类
+class Superman
+{
+ public $power = [];//超人技能
+
+ //超人改造 能力接口规范 遵循能力接口规范的才可以
+ public function __construct(Ability $ability = null)
+ {
+ //设置超人每个技能名字
+ if($ability != null){
+ $name = strtolower(get_class($ability));
+ $this->power[$name] = $ability;
+ }
+ }
+ /**
+ * @Author shyn
+ * @DateTime 2017-12-20
+ * @param [type] $ability [能力对象]
+ * [超人添加 二次添加其他能力]
+ */
+ public function addAbility(Ability $ability)
+ {
+ $name = strtolower(get_class($ability));
+ $this->power[$name] = $ability;
+
+ }
+ // 查看超人能力
+ public function __toString()
+ {
+ if(count($this->power)<1){
+ return '超人无能纳,还没任何技能';
+ }
+ foreach ($this->power as $key => $value) {
+ echo $key.'=>'.$value.'
';
+ }
+ return '超人共有'.count($this->power).'个技能';
+ }
+}
+
+
+//这里用到我们的神器:首先创建一个容器类
+//工厂模式抛弃 制造一个更高级的工厂 容器(超级工厂)
+/**
+ * 容器类的使用方法
+ * 1.有两个属性 两个方法
+ * 2.
+ */
+class Container
+{
+ //$binds用于保存我们 不同绑定类传来的匿名函数(function(){} 并没有执行)
+ //如下面:保存为这样$binds['flight']=function(){};
+ public $binds;
+ public $instances;
+
+ /**
+ * @Author shyn
+ * @DateTime 2017-12-20
+ * @param [type] $abstract ['初始对象实例名 用于保存在']
+ * @param [type] $concreate [匿名函数]
+ * @return [type] [description]
+ */
+ public function bind($abstract, $concreate)
+ {
+ if($concreate instanceof Closure){
+ $this->binds[$abstract] = $concreate;
+ }else{
+ $this->instances[$abstract] = $concreate;
+ }
+
+ }
+
+ //执行绑定到$binds 中的function(){}
+ public function make($abstract, $parameters = [])
+ {
+ if(isset($this->instances[$abstract])){
+ return $this->instances[$abstract];
+ }
+
+ array_unshift($parameters, $this);//将this 添加到数组 $parameters 用于call_user_func_array() 这点看@@清楚
+ // 将数组 $parameters 作为参数传递给回调函数$this->binds[$abstract] $abstract 是类名
+ return call_user_func_array($this->binds[$abstract], $parameters);
+ }
+}
+
+
+// 创建一个容器 (超级工厂生成) 下面我们来把将要实例化的放进来
+// 切记放进来并没有实例化 make()方法才开始实例化到执行
+// 具体make() 函数看透就明白了 这点会有点绕 冷静下来接着干 往下看
+$container = new Container();
+
+//把超人技能 Flight类 保存在容器类(Container) $binds 属性中
+//其实是保存的 function($container){return new Flight()} 并没有执行
+//make 方法才是开始执行已经绑定到$binds 属性中的匿名函数【function(){}】
+$container->bind('flight', function($container){
+ return new Flight();
+});
+
+//同上 记住这里只是绑定 到$binds 属性中 为了 下面使用
+$container->bind('ultrabomb', function($container){
+ return new UltraBomb;
+});
+//同上 绑定到$binds 这里的function(){} 函数并没有执行 切记【强调】
+$container->bind('Force', function($container){
+ return new Force;
+});
+// echo '';
+// var_dump($container); 可以使用本句查看上面已经在 $container 中的绑定
+
+
+
+//因为我们要使用我们的超人类(Superman)所以 也要绑定到容器
+//作用:
+//1.绑定到容器其实就是为了我们用容器的make()方法实例化Superman 然后使用
+//2.不用我们在自己另外实例化,好处就是当我们要创造多个超人的时候 用容器来实例化多个超人就变得容易
+$container->bind('superman', function($container, $ability){
+ // 下面的传参数为了拥有超人的 能力 这里是重点 仔细理解
+ return new Superman( $container->make($ability) );
+});
+
+
+//这里传入的参数superman 是根据上面 bind('super',function(){}) 方法传参定的 这里要和上面一样
+//ultrabomb 对应的是 bind('ultrabomb',function(){})
+$superman_1 = $container->make('superman', ['ultrabomb']);
+echo '';
+// var_dump($superman_1);//查看技能是否绑定到了$power
+$superman_1->power['ultrabomb']->activate();//使用技能
+// echo $superman_1;
\ No newline at end of file
diff --git a/php/ioc/superManFactory.php b/php/ioc/superManFactory.php
new file mode 100644
index 0000000..808b763
--- /dev/null
+++ b/php/ioc/superManFactory.php
@@ -0,0 +1,192 @@
+speed = $speed;
+ $this->holdtime = $holdtime;
+ }
+ //激活该技能
+ public function activate(array $target = [])//参数可以忽略 保留待用
+ {
+ echo '超人飞行开始';
+ }
+
+ //输出该类实例(就是对象实例 如:new Flight;) 显示信息
+ public function __toString()
+ {
+ return $this->skill.'速度:'.$this->speed.' 飞翔时间:'.$this->holdtime;
+ }
+}
+
+
+//射击能力
+class Shot{
+ protected $attack;//伤害
+ protected $range;//伤害范围
+ protected $skill = '射击技能=';//技能解说
+ public function __construct($attack = 0, $range = 0)
+ {
+ $this->attack = $attack;
+ $this->range = $range;
+ }
+
+ //激活技能
+ public function activate(array $target = [])
+ {
+ echo '超人射击开始';
+ }
+ public function __toString()
+ {
+
+ return $this->skill.'伤害:'.$this->attack.' 射击距离:'.$this->range;
+ }
+
+}
+
+//暴击能力
+class Force implements Ability
+{
+ protected $attack;//伤害
+ protected $strength;//力量
+ protected $range;//范围
+ protected $skill;//技能标签
+ public function __construct($attack = 0, $range = 0, $strength = 0)
+ {
+ $this->attack = $attack;
+ $this->range = $range;
+ $this->strength = $strength;
+ }
+
+ //激活暴击技能
+ public function activate(array $target = [])
+ {
+ echo '超人暴力攻击';
+ }
+
+ public function __toString()
+ {
+ $this->skill = '暴力能力=';
+ return $this->skill.'伤害:'.$this->attack.' 力量:'.$this->strength.' 范围'.$this->range;
+ }
+}
+
+//终极炸弹能力(扔炸弹)
+class UltraBomb implements ability
+{
+ protected $skill = '炸弹技能=';
+ protected $range;
+ protected $attack;
+
+ public function __construct($range = 0 , $attack = 0)
+ {
+ $this->range = $range;
+ $this->attack = $attack;
+
+ }
+ /**
+ * @Author shyn
+ * @DateTime 2017-12-20
+ * @param integer $bombRange [炸弹伤害范围]
+ * @param integer $attack [炸弹伤害程度]
+ * @return [type] [description]
+ * [使用炸弹]
+ */
+ public function throwBomb($range = 5, $attack = 10){
+
+ echo '炸弹范围'.$range.'米 伤害为:'.$attack;
+ }
+
+ public function activate(array $target = [])
+ {
+ echo '超人炸弹发射';
+ return $this;
+ }
+
+ public function __toString()
+ {
+ return $this->skill.'伤害:'.$this->attack.' 爆炸范围:'.$this->range;
+ }
+
+}
+
+//超人技能工厂类
+class abilityFactory{
+
+ public function makeSkill($moduleName , $optoin)
+ {
+ switch($moduleName){
+ case 'Flight':
+ return new Flight($optoin[0], $optoin[1]);
+ case 'Force':
+ return new Force($optoin[0]);
+ case 'Shot':
+ return new Shot($optoin[0], $optoin[1], $optoin[2]);
+ }
+
+ }
+}
+
+
+//超人类
+class Superman
+{
+ public $power = [];//用来保存超人技能 超人会有多个技能所以用数组
+
+ //初始化时传入传入技能类的名称
+ public function __construct(array $ability)
+ {
+ //这里使用超人能力工厂类
+ //优点:
+ //1.方便对技能的管理 直接在工厂里添加我们扩展的其他超人技能
+ //2.我们的超人类不用直接依赖我们的超人技能类
+ //缺点:
+ //1.不用直接依赖我们的超人技能类但是依赖了工厂类
+ //2.工厂类改变的话我们的超人技能必将受到影响
+ //3.有没有更好的方法来 当然有把这里理解后就可以继续往下看 我们的神器:容器(可称为超级工厂)
+ //4.容器是什么 不是什么 a.你可以理解一个更厉害的类 b.解决了超人类对工厂类的依赖
+ $af = new abilityFactory();//实例化工厂类
+ foreach ($ability as $abilityName => $abilityOptions) {
+ $this->power[] = $af->makeSkill($abilityName, $abilityOptions);
+
+ }
+ }
+
+ // 查看超人能力
+ public function __toString()
+ {
+ if(count($this->power)<1){
+ return '超人无能纳,还没任何技能';
+ }
+ foreach ($this->power as $key => $value) {
+ echo $key.'=>'.$value.'
';
+ }
+ return '超人共有'.count($this->power).'个技能';
+ }
+}
+
+$ability = ['Flight'=>[1,4]];//填写超人技能类名不区分大小写对应 能力工厂类中case
+$superman = new Superman($ability);
+
+echo '';
+var_dump($superman);//此时可以看到超人类中power 属性已经拥有该超人技能对象
+$superman->power[0]->activate([]);//使用技能 看到这里完美 activate([]) 传递了一个空数组完全可以不需要 这里为了你可以传递技能参数故意添加的 可以自己试试搞一下 有些东西得练一下才好记得才明白
diff --git a/php/laravel-core-learn/array_reduce.php b/php/laravel-core-learn/array_reduce.php
new file mode 100644
index 0000000..64607ca
--- /dev/null
+++ b/php/laravel-core-learn/array_reduce.php
@@ -0,0 +1,23 @@
+log = $log;
+ }
+ public function login()
+ {
+ // 登录成功,记录登录日志
+ echo 'login success...';
+ $this->log->write();
+ }
+}
+
+class Ioc
+{
+ public $binding = [];
+
+ public function bind($abstract, $concrete)
+ {
+ //这里为什么要返回一个closure呢?因为bind的时候还不需要创建User对象,所以采用closure等make的时候再创建FileLog;
+ $this->binding[$abstract]['concrete'] = function ($ioc) use ($concrete) {
+ return $ioc->build($concrete);
+ };
+
+ }
+
+ public function make($abstract)
+ {
+ // 根据key获取binding的值
+ $concrete = $this->binding[$abstract]['concrete'];
+ return $concrete($this);
+ }
+
+ // 创建对象
+ public function build($concrete) {
+ $reflector = new ReflectionClass($concrete);
+ $constructor = $reflector->getConstructor();
+ if(is_null($constructor)) {
+ return $reflector->newInstance();
+ }else {
+ $dependencies = $constructor->getParameters();
+ $instances = $this->getDependencies($dependencies);
+ return $reflector->newInstanceArgs($instances);
+ }
+ }
+
+ // 获取参数的依赖
+ protected function getDependencies($paramters) {
+ $dependencies = [];
+ foreach ($paramters as $paramter) {
+ $dependencies[] = $this->make($paramter->getClass()->name);
+ }
+ return $dependencies;
+ }
+
+}
+
+//实例化IoC容器
+$ioc = new Ioc();
+$ioc->bind('log','FileLog');
+$ioc->bind('user','User');
+// $user = $ioc->make('user');
+// $user->login();
+
+class UserFacade
+{
+ protected static $ioc;
+
+ public static function setFacadeIoc($ioc)
+ {
+ static::$ioc = $ioc;
+ }
+
+ protected static function getFacadeAccessor()
+ {
+ return 'user';
+ }
+
+ public static function __callStatic($method, $args)
+ {
+ var_dump($method);
+ $instance = static::$ioc->make(static::getFacadeAccessor());
+ return $instance->$method(...$args);
+ }
+}
+UserFacade::setFacadeIoc($ioc);
+
+UserFacade::login();
diff --git a/php/laravel-core-learn/log.php b/php/laravel-core-learn/log.php
new file mode 100644
index 0000000..041cdce
--- /dev/null
+++ b/php/laravel-core-learn/log.php
@@ -0,0 +1,159 @@
+fileLog = new Filelog();
+ }
+
+ public function login()
+ {
+ echo 'login success';
+ $this->fileLog->write();
+ }
+}
+
+// $user = new User1();
+// $user->login();
+
+class User
+{
+ protected $log;
+ public function __construct(log $filelog)
+ {
+ $this->log = $filelog;
+ }
+
+ public function login()
+ {
+ echo 'login';
+ $this->log->write();
+ }
+
+}
+
+function make($concrete)
+{
+ $reflector = new ReflectionClass($concrete);
+ $constructor = $reflector->getConstructor();
+ if(is_null($constructor)){
+ return $reflector->newInstance();
+ } else {
+ //构造函数依赖的参数
+ $dependencies = $constructor->getParameters();
+ //根据参数返回实例
+ $instances = getDependencies($dependencies);
+ return $reflector->newInstanceArgs($instances);
+ }
+}
+
+function getDependencies($paramters)
+{
+ $dependencies = [];
+ foreach($paramters as $paramter)
+ {
+ var_dump($paramter->getClass()->name);
+ $dependencies[] = make($paramter->getClass()->name);
+ }
+ return $dependencies;
+}
+
+// $user = new User1(new Databaselog());
+// $user->login();
+
+//反射
+// $class = new ReflectionClass(User::class);
+// $constructor = $class->getConstructor();
+// $dependencies = $constructor->getParameters();
+
+// $user = $reflector->newInstance();
+// $user = $reflector->newInstanceArgs();
+
+
+
+
+// $user = make('User');
+// $user->login();
+
+class Ioc
+{
+ public $binding = [];
+
+ public function bind($abstract, $concrete)
+ {
+ //bind时不需要创建user对象,采用closure等make时候在创建
+ $this->binding[$abstract]['concrete'] = function($ioc) use ($concrete) {
+ // var_dump($concrete);
+ return $ioc->build($concrete);
+ };
+ }
+ public function make($abstract)
+ {
+ $concrete = $this->binding[$abstract]['concrete'];
+ // var_dump($abstract);
+ return $concrete($this);
+ }
+
+ public function build($concrete)
+ {
+ echo '---bulid----'.PHP_EOL;
+ $reflector = new ReflectionClass($concrete);
+ $constructor = $reflector->getConstructor();
+ if(is_null($constructor)){
+ echo '---constructor NULl---'.PHP_EOL;
+ return $reflector->newInstance();
+ } else {
+ echo '---constructor-----'.PHP_EOL;
+ var_dump($constructor);
+ $dependencies = $constructor->getParameters();
+ // var_dump($dependencies);
+ $instances = $this->getDependencies($dependencies);
+ // var_dump($instances);
+ return $reflector->newInstanceArgs($instances);
+ }
+ }
+
+ protected function getDependencies($paramters)
+ {
+ $dependencies = [];
+ foreach($paramters as $paramter)
+ {
+ echo 'params-class-name'.PHP_EOL;
+ var_dump($paramter->getClass()->name);
+ $dependencies[] = $this->make($paramter->getClass()->name);
+ }
+ return $dependencies;
+ }
+}
+
+$ioc = new Ioc();
+$ioc->bind('log','FileLog');
+//log为__construct中的接口,Filelog为某个具体的类
+$ioc->bind('user','User');
+//user为要make的类的别名,User为需要实例化的类
+var_dump($ioc->binding);
+$user = $ioc->make('user');
+// $user->login();
diff --git a/php/laravel-core-learn/milldeware.php b/php/laravel-core-learn/milldeware.php
new file mode 100644
index 0000000..6d246f1
--- /dev/null
+++ b/php/laravel-core-learn/milldeware.php
@@ -0,0 +1,70 @@
+x = $x;
+ $this->y = $y;
+ }
+}
+
+class Circle
+{
+ /**
+ * @var int
+ */
+ public $radius; //半径
+ /**
+ * @var Point
+ */
+ public $center;//圆心点
+
+ CONST PI = 3.14;
+
+ public function __construct(Point $point, $radius = 1)
+ {
+ $this->center = $point;
+ $this->radius = $radius;
+ }
+
+ //打印圆点坐标
+ public function printCenter()
+ {
+ printf('center coordinate is (%d, %d)',$this->center->x,$this->center->y);
+ }
+ //计算圆形面积
+ public function area()
+ {
+ return 3.14 * pow($this->radius, 2);
+ }
+}
+
+$reflectionClass = new ReflectionClass(Circle::class);
+/**
+ * 返回值如下
+object(ReflectionClass)#1 (1) {
+ ["name"]=>
+ string(6) "Circle"
+}
+ */
+$reflectionClass->getConstants();
+/**
+ * 反射出类的常量
+array(1) {
+ ["PI"]=>
+ float(3.14)
+}
+ */
+$reflectionClass->getProperties();
+/**
+ *
+ * 返回一个由ReflectionProperty对象构成的数组
+array(2) {
+ [0]=>
+ object(ReflectionProperty)#2 (2) {
+ ["name"]=>
+ string(6) "radius"
+ ["class"]=>
+ string(6) "Circle"
+ }
+ [1]=>
+ object(ReflectionProperty)#3 (2) {
+ ["name"]=>
+ string(6) "center"
+ ["class"]=>
+ string(6) "Circle"
+ }
+}
+ */
+$reflectionClass->getMethods();
+/**
+ * 反射出类中定义的方法
+ * 返回ReflectionMethod对象构成的数组
+
+array(3) {
+ [0]=>
+ object(ReflectionMethod)#2 (2) {
+ ["name"]=>
+ string(11) "__construct"
+ ["class"]=>
+ string(6) "Circle"
+ }
+ [1]=>
+ object(ReflectionMethod)#3 (2) {
+ ["name"]=>
+ string(11) "printCenter"
+ ["class"]=>
+ string(6) "Circle"
+ }
+ [2]=>
+ object(ReflectionMethod)#4 (2) {
+ ["name"]=>
+ string(4) "area"
+ ["class"]=>
+ string(6) "Circle"
+ }
+}
+ */
+$constructor = $reflectionClass->getConstructor();
+/**
+ * 我们还可以通过getConstructor()来单独获取类的构造方法,其返回值为一个ReflectionMethod对象。
+ *
+ */
+$parameters = $constructor->getParameters();
+/**
+ * 其返回值为ReflectionParameter对象构成的数组。
+
+array(2) {
+ [0]=>
+ object(ReflectionParameter)#3 (1) {
+ ["name"]=>
+ string(5) "point"
+ }
+ [1]=>
+ object(ReflectionParameter)#4 (1) {
+ ["name"]=>
+ string(6) "radius"
+ }
+}
+ */
+//构建类的对象
+function make($className)
+{
+ $reflectionClass = new ReflectionClass($className);
+ $constructor = $reflectionClass->getConstructor();
+ $parameters = $constructor->getParameters();
+ $dependencies = getDependencies($parameters);
+
+ return $reflectionClass->newInstanceArgs($dependencies);
+}
+
+//依赖解析
+function getDependencies($parameters)
+{
+ $dependencies = [];
+ foreach($parameters as $parameter) {
+ $dependency = $parameter->getClass();
+ if (is_null($dependency)) {
+ if($parameter->isDefaultValueAvailable()) {
+ $dependencies[] = $parameter->getDefaultValue();
+ } else {
+ //不是可选参数的为了简单直接赋值为字符串0
+ //针对构造方法的必须参数这个情况
+ //laravel是通过service provider注册closure到IocContainer,
+ //在closure里可以通过return new Class($param1, $param2)来返回类的实例
+ //然后在make时回调这个closure即可解析出对象
+ //具体细节我会在另一篇文章里面描述
+ $dependencies[] = '0';
+ }
+ } else {
+ //递归解析出依赖类的对象
+ $dependencies[] = make($parameter->getClass()->name);
+ }
+ }
+
+ return $dependencies;
+}
+
+$circle = make('Circle');
+$circle->printCenter();
+$area = $circle->area();
+var_dump($circle,$area);
+
+/*var_dump($circle, $area);
+object(Circle)#6 (2) {
+ ["radius"]=>
+ int(1)
+ ["center"]=>
+ object(Point)#11 (2) {
+ ["x"]=>
+ int(0)
+ ["y"]=>
+ int(0)
+ }
+}
+float(3.14)*/
\ No newline at end of file
diff --git a/php/mysql.txt b/php/mysql.txt
new file mode 100644
index 0000000..c62dbac
--- /dev/null
+++ b/php/mysql.txt
@@ -0,0 +1,7 @@
+1,索引 btree索引和hash索引
+
+hash索引仅仅能满足=,in 和<=>查询,不能使用范围查询
+hash索引无法被用来避免数据的排序操作
+hash索引不支持多列联合索引及like ***%查询
+hash索引在任何时候都不能避免表扫描
+在有大量重复键值情况下,哈希索引的效率也是极低的,因为存在所谓的哈希碰撞问题
\ No newline at end of file
diff --git a/php/mytest.php b/php/mytest.php
new file mode 100644
index 0000000..5f7816e
--- /dev/null
+++ b/php/mytest.php
@@ -0,0 +1,6 @@
+
+
+
diff --git a/java/test.java "b/php/php\347\237\245\350\257\206\347\202\271.txt"
similarity index 100%
rename from java/test.java
rename to "php/php\347\237\245\350\257\206\347\202\271.txt"
diff --git a/php/plugin/plugin1/config.php b/php/plugin/plugin1/config.php
new file mode 100644
index 0000000..3187229
--- /dev/null
+++ b/php/plugin/plugin1/config.php
@@ -0,0 +1,11 @@
+ 1, // 定义状态 1表示开启 0表示关闭
+ 'title' => '发送短信', // 插件的名称
+ );
diff --git a/php/redisBuy.php b/php/redisBuy.php
new file mode 100644
index 0000000..a9cd141
--- /dev/null
+++ b/php/redisBuy.php
@@ -0,0 +1,65 @@
+connect('127.0.0.1', 6379);
+$res = $redis->llen('goods_store');
+echo $res;
+$count = $store - $res;
+for($i = 0; $i < $count; $i++)
+{
+ $redis->lpush('goods_store',1);
+}
+echo $redis->llen('goods_store');
+
+$conn=mysql_connect("localhost","big","123456");
+if(!$conn){
+ echo "connect failed";
+ exit;
+}
+
+//
+mysql_select_db("big",$conn);
+mysql_query("set names utf8");
+
+$price=10;
+$user_id=1;
+$goods_id=1;
+$sku_id=11;
+$number=1;
+
+//生成唯一订单号
+function build_order_no(){
+ return date('ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
+}
+//记录日志
+function insertLog($event,$type=0){
+ global $conn;
+ $sql="insert into ih_log(event,type)
+ values('$event','$type')";
+ mysql_query($sql,$conn);
+}
+
+//模拟下单操作
+//下单前判断redis队列库存量
+$redis=new Redis();
+$result=$redis->connect('127.0.0.1',6379);
+$count=$redis->lpop('goods_store');
+if(!$count){
+ insertLog('error:no store redis');
+ return;
+}
+
+//生成订单
+$order_sn=build_order_no();
+$sql="insert into ih_order(order_sn,user_id,goods_id,sku_id,price)
+values('$order_sn','$user_id','$goods_id','$sku_id','$price')";
+$order_rs=mysql_query($sql,$conn);
+
+//库存减少
+$sql="update ih_store set number=number-{$number} where sku_id='$sku_id'";
+$store_rs=mysql_query($sql,$conn);
+if(mysql_affected_rows()){
+ insertLog('库存减少成功');
+}else{
+ insertLog('库存减少失败');
+}
diff --git a/php/test.php b/php/test.php
index e69de29..5849d85 100644
--- a/php/test.php
+++ b/php/test.php
@@ -0,0 +1,51 @@
+a += 1;
+ }
+
+ public function __call($name, $arguments)
+ {
+ return ++$this->a;
+ }
+}
+class b extends a
+{
+ public function methodA()
+ {
+ return $this->a;
+ }
+}
+
+$res1 = (new b())->methodA();
+$res2 = (new b())->methodB();
+var_dump($res1,$res2);
+
+$arr = ['a'=>1,'b'=>2,'c'=>3];
+$arr2 = [];
+foreach($arr as $vo)
+{
+ $arr2[] = $vo;
+}
+var_dump($arr2);
+
+$num = 18;
+$fun = function($a) {
+ return $a + $num;
+};
+$res = $fun(10);
+var_dump($res);
+
+echo (intval((0.7 + 0.1) * 100 /10));
diff --git a/unix/.idea/compiler.xml b/unix/.idea/compiler.xml
new file mode 100644
index 0000000..96cc43e
--- /dev/null
+++ b/unix/.idea/compiler.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/unix/.idea/copyright/profiles_settings.xml b/unix/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/unix/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/unix/.idea/linux.iml b/unix/.idea/linux.iml
new file mode 100644
index 0000000..d6ebd48
--- /dev/null
+++ b/unix/.idea/linux.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/unix/.idea/misc.xml b/unix/.idea/misc.xml
new file mode 100644
index 0000000..3f08c7c
--- /dev/null
+++ b/unix/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/unix/.idea/modules.xml b/unix/.idea/modules.xml
new file mode 100644
index 0000000..ee94cb1
--- /dev/null
+++ b/unix/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/unix/.idea/workspace.xml b/unix/.idea/workspace.xml
new file mode 100644
index 0000000..fc4eab2
--- /dev/null
+++ b/unix/.idea/workspace.xml
@@ -0,0 +1,315 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ DEFINITION_ORDER
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1530770746167
+
+
+ 1530770746167
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/unix/accept b/unix/accept
new file mode 100644
index 0000000..aef0eee
Binary files /dev/null and b/unix/accept differ
diff --git a/unix/acceptTest.cpp b/unix/acceptTest.cpp
new file mode 100644
index 0000000..64c87af
--- /dev/null
+++ b/unix/acceptTest.cpp
@@ -0,0 +1,55 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+int main( int argc, char* argv[] )
+{
+ if( argc<=2 ){
+ printf("usage:%s ip_address port_number \n", basename(argv[0]));
+ return 1;
+ }
+ const char* ip = argv[1];
+ int port = atoi( argv[2] );
+ //创建一个IPv4 socket地址
+ struct sockaddr_in address;
+ bzero( &address, sizeof( address ) );
+ address.sin_family = AF_INET;
+ inet_pton( AF_INET, ip, &address.sin_addr );
+ address.sin_port = htons( port );
+
+ int sock = socket( PF_INET, SOCK_STREAM, 0);
+ assert( sock >= 0 );
+
+ int ret = bind(sock,(struct sockaddr*)&address, sizeof(address));
+ assert( ret != 1 );
+
+ ret = listen(sock,5);
+ assert( ret != 1 );
+ //暂停20秒以等待客户端链接和相关操作完成
+ sleep( 20 );
+ struct sockaddr_in client;
+ socklen_t client_addrlength = sizeof( client );
+ int connfd = accept( sock, (struct sockaddr*)&client, &client_addrlength);
+ if( connfd < 0 )
+ {
+ printf("errno is:%d\n",errno);
+ }
+ else
+ {
+ char remote[INET_ADDRSTRLEN];
+ printf("connected with ip:%s and port:%d\n",inet_ntop(AF_INET,&client.sin_addr,remote,INET_ADDRSTRLEN),ntohs(client.sin_port));
+ close( connfd );
+ }
+ close( sock );
+ return 0;
+}
+
+
diff --git a/unix/cgi b/unix/cgi
new file mode 100644
index 0000000..25f75aa
Binary files /dev/null and b/unix/cgi differ
diff --git a/unix/cgi.cpp b/unix/cgi.cpp
new file mode 100644
index 0000000..9bf1f18
--- /dev/null
+++ b/unix/cgi.cpp
@@ -0,0 +1,52 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+int main (int argc, char* argv[])
+{
+ if( argc<=2 ){
+ printf("usage:%s ip_address port_number \n", basename(argv[0]));
+ return 1;
+ }
+ const char* ip = argv[1];
+ int port = atoi( argv[2] );
+ //创建一个IPv4 socket地址
+ struct sockaddr_in address;
+ bzero( &address, sizeof( address ) );
+ address.sin_family = AF_INET;
+ inet_pton( AF_INET, ip, &address.sin_addr );
+ address.sin_port = htons( port );
+
+ int sock = socket( PF_INET, SOCK_STREAM, 0);
+ assert( sock >= 0 );
+
+ int ret = bind(sock,(struct sockaddr*)&address, sizeof(address));
+ assert( ret != 1 );
+
+ ret = listen(sock,5);
+ assert( ret != 1 );
+
+ struct sockaddr_in client;
+ socklen_t client_addrlength = sizeof( client );
+ int connfd = accept( sock, (struct sockaddr*)&client, &client_addrlength);
+ if( connfd < 0 )
+ {
+ printf("errno is:%d\n",errno);
+ }
+ else
+ {
+ close(STDOUT_FILENO);
+ dup(connfd);
+ printf("abcd\n");
+ close(connfd);
+ }
+
+ close(sock);
+ return 0;
+}
\ No newline at end of file
diff --git a/unix/epoll.cpp b/unix/epoll.cpp
new file mode 100644
index 0000000..79d6f95
--- /dev/null
+++ b/unix/epoll.cpp
@@ -0,0 +1,73 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define MAX_EVENT_NUMBER 1024
+#define BUFFER_SIZE 10
+/**将文件描述符设置成非阻塞的 */
+int setnonblocking( int fd )
+{
+ int old_option = fcntl( fd, F_GETFL );
+ int new_option = old_option | O_NONBLOCK;
+ fcntl( fd, F_SETFL, new_option );
+ return old_option;
+}
+
+/**将文件描述符fd上的EPOLLIN注册到epollfd指示的epoll内核事件表中,参数enable_et指定是否对fd启用ET模式 */
+
+void addfd( int epollfd, int fd, bool enable_et )
+{
+ epoll_event event;
+ event.data.fd = fd;
+ event.events = EPOLLIN;
+ if( enable_et )
+ {
+ event.events != EPOLLET;
+ }
+ epoll_ctl (epollfd, EPOLL_CTL_ADD, fd, &event);
+ setnonblocking(fd);
+}
+
+/** LT模式的工作流程 */
+void lt( epoll_event* events, int number, int epollfd, int listenfd )
+{
+ char buf[ BUFFER_SIZE ];
+ for( int i = 0; i < number; i++ )
+ {
+ int sockfd = events[i].data.fd;
+ if( sockfd == listenfd )
+ {
+ struct sockaddr_in client_address;
+ socklen_t client_addrlength = sizeof( client_address );
+ int connfd = accept( listenfd, (struct sockaddr*)&client_address, &client_addrlength );
+ addfd( epollfd, connfd, false);/**对connfd禁用ET模式*/
+ }
+ else if( events[i].events & EPOLLIN )
+ {
+ /* 只要socket读缓存中还有为读出的数据,这段代码就被触发 */
+ printf("event trigger once\n");
+ memset( buf, '\0', BUFFER_SIZE);
+ int ret = recv(sockfd, buf, BUFFER_SIZE-1,0);
+ if( ret <= 0 )
+ {
+ close( sockfd );
+ continue;
+ }
+ printf("get %d bytes of content: %s\n", ret, buf);
+ }
+ else
+ {
+ printf( " something else happened \n" );
+ }
+ }
+}
diff --git a/unix/getUser b/unix/getUser
new file mode 100644
index 0000000..46c3291
Binary files /dev/null and b/unix/getUser differ
diff --git a/unix/getUser.cpp b/unix/getUser.cpp
new file mode 100644
index 0000000..5564c01
--- /dev/null
+++ b/unix/getUser.cpp
@@ -0,0 +1,40 @@
+#include
+#include
+
+int main()
+{
+ uid_t uid = getuid();
+ uid_t euid = geteuid();
+ printf("userid is %d, effective userid is %d\n", uid, euid );
+ return 0;
+}
+
+static bool switch_to_user( uid_t user_id, gid_t gp_id)
+{
+ //先确保目标用户不是root
+ if( ( user_id == 0 ) && ( gp_id == 0 ))
+ {
+ return false;
+ }
+
+ //确保当前用户是合法用户
+ gid_t gid = getgid();
+ uid_t uid = getuid();
+
+ if( ( ( gid != 0) || ( uid != 0 ) ) && ( (gid != gd_id ) || ( uid != user_id)) )
+ {
+ return false;
+ }
+ //如果不是root,则已经是目标用户
+ if ( uid != 0)
+ {
+ return true;
+ }
+ //切换到目标用户
+ if ( ( setgid( gp_id ) < 0 ) || ( setuid( user_id ) < 0 ))
+ {
+ return false;
+ }
+
+ return true;
+}
diff --git a/unix/httpServer.cpp b/unix/httpServer.cpp
new file mode 100644
index 0000000..94530f7
--- /dev/null
+++ b/unix/httpServer.cpp
@@ -0,0 +1,272 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define BUFFER_SIZE 4096 //读缓冲区大小
+//主状态机的两种可能状态,分别表示:当前正在分析请求行,当前正在分析头部字段
+enum CHECK_STATE {CHECK_STATE_REQUESTLINE = 0,CHECK_STATE_HEADER };
+//从状态机的三种可能状态,即行的读取状态,分别表示:读取到一个完整的行、行出错和行数据尚且不完整
+enum LINE_STATUS {LINK_OK = 0, LINE_BAD, LINE_OPEN };
+/*
+ 服务器处理HTTP请求的结果:NO_REQUEST表示请求不完整,需要继续读取客户数据;GET_REQUEST表示获得了
+ 一个完整的客户请求:BAD_RQUEST表示客户请求有语法错误:FORBIDDEN_REQUEST表示客户对资源没有足够的
+ 访问权限:INTERNAL_ERROR表示服务器的内部错误;CLOSED_CONNECTION表示客户已经关闭链接了
+*/
+enum HTTP_CODE {NO_REQUEST, GET_REQUEST, BAD_REQUEST, FORBIDDEN_REQUEST, INTERNAL_ERROR, CLOSED_CONNECTION};
+//为了简化信息,我们没有给客户发送一个完整的HTTP应答报文,而是根据服务器的处理结果发送如下成功和失败信息
+static const char* szret[] = {"I get a correct result\n", "Something wrong\n"};
+
+//从状态机,用于解析出一行内容
+LINE_STATUS parse_line( char* buffer, int& checked_index, int& read_index)
+{
+ char temp;
+ /*
+ checked_index 指向buffer(应用程序的读缓冲区)中当前正在分析的字符,read_index指向buffer中客户数据的
+ 尾部的下一字节,buffer中第0~checked_index字节都已分析完毕,第checked_index~(read_index-1)字节由下面的
+ 循环挨个分析
+ */
+ for( ; checked_index < read_index; ++checked_index)
+ {
+ //获取当前要分析的字节
+ temp = buffer[ checked_index ];
+ //如果当前的字节是“\r”,即回车符,则说明可能读取到一个完整的行
+ if(temp == '\r')
+ {
+ //如果“\r”字符碰巧是目前的buffer中的最后一个已经被读入的客户端数据,那么这侧分析没有读到一个完整的行
+ //放回LINE_OPEN以表示还需要继续读取客户数据才能进一步分析
+ if( ( checked_index + 1) == read_index )
+ {
+ return LINE_OPEN;
+ }
+ //如果下一个字符是“\n”,则说明我们成功读取到一个完整的行
+ else if (buffer[ checked_index + 1] == '\n')
+ {
+ buffer[ checked_index++ ] = '\0';
+ buffer[ checked_index++ ] = '\0';
+ return LINE_OK;
+ }
+ //否则的话,说明客户发送的HTTP请求存在语法问题
+ return LINE_BAD;
+
+ }
+ //如果当前的字节是“\n”,即换行符,则说明可能读取到一个完整的行
+ else if (temp == '\n')
+ {
+ if(( checked_index > 1) && buffer[ checked_index -1 ] == '\r')
+ {
+ buffer[ checked_index - 1 ] = '\0';
+ buffer[ checked_index++ ] = '\0';
+ return LINE_OK;
+ }
+ return LINE_BAD;
+ }
+ }
+ //如果所有内容都分析完毕也没有遇到"\r"字符,则返回LINE_OPEN,表示还需要继续读取客户数据才能进一步分析
+ return LINE_OPEN;
+}
+
+HTTP_CODE parse_requestline( char* temp, CHECK_STATE& checkstate)
+{
+ char* url = strpbrk(temp," \t");
+ //如果请求行中没有空白字符或"\t"字符,则HTTP请求必有问题
+ if( !url )
+ {
+ return BAD_REQUEST;
+ }
+ *url++ = '\0';
+ char* method = temp;
+ if( strcasecmp(method,"GET") == 0)//仅支持GET方法
+ {
+ printf("The request method is GET \n");
+ }
+ else
+ {
+ return BAD_REQUEST;
+ }
+ url += strspn(url, " \t");
+ char* version = strpbrk( url, " \t");
+ if( !version )
+ {
+ return BAD_REQUEST;
+ }
+ *version++ = '\0';
+ version += strspn( version, " \t");
+ //仅支持HTTP/1.1
+ if( strcasecmp(version, "HTTP/1.1") != 0)
+ {
+ return BAD_REQUEST;
+ }
+ //检查URL是否合法
+ if( strncasecmp(url, "http://", 7 ) == 0 )
+ {
+ url += 7;
+ url = strchr( url, '/');
+ }
+ if( !url || url[0] != '/')
+ {
+ return BAD_REQUEST;
+ }
+ printf("The request URL is: %s\n", url );
+ //HTTP请求行处理完毕,状态转移到头部字段的分析
+ checkstate = CHECK_STATE_HEADER;
+ return NO_REQUEST;
+}
+
+//分析头部字段
+HTTP_CODE parse_headers( char* temp )
+{
+ //遇到一个空行,说明我们得到了一个正确的HTTP请求
+ if( temp[0] == '\0')
+ {
+ return GET_REQUEST;
+ }
+ else if (strncasecmp( temp, "Host:", 5) == 0)
+ {
+ temp += 5;
+ temp += strspn( temp, " \t");
+ printf("the request host is:%s\n", temp );
+ }
+ else //其他头部字段不处理
+ {
+ prinf("I can not handle this header\n");
+ }
+ return NO_REQUEST;
+}
+
+//分析HTTP入口函数
+HTTP_CODE parse_content( char* buffer, int& checked_index, CHECK_STATE &checkstate, int& read_index, int& start_line)
+{
+ LINE_STATUS linestatus = LINE_OK;
+ HTTP_CODE retcode = NO_REQUEST;
+ //主状态机,用户从buffer中取出所有完整的行
+ while( ( linestatus = parse_line(buffer, checked_index, read_index)) == LINE_OK )
+ {
+ char* temp = buffer + start_line;
+ start_line = checked_index;
+ //checkstate 记录主状态机当前的状态
+ switch ( checkstate )
+ {
+ case CHECK_STATE_REQUESTLINE:
+ {
+ retcode = parse_requestline( temp, checkstate );
+ if( retcode == BAD_REQUEST )
+ {
+ return BAD_REQUEST;
+ }
+ break;
+ }
+ case CHECK_STATE_HEADER: //第二个状态 分析头部字段
+ {
+ retcode = parse_headers( temp );
+ if( retcode == BAD_REQUEST )
+ {
+ return BAD_REQUEST;
+ }
+ else if( retcode == GET_REQUEST )
+ {
+ return GET_REQUEST;
+ }
+ break;
+ }
+ default:
+ {
+ return INTERNAL_ERROR;
+ }
+ }
+ }
+ //若没有读取到一个完整的行,则表示还需要继续读取客户数据才能进一步分析
+ if( linestatus == LINE_OPEN )
+ {
+ return NO_REQUEST;
+ }
+ else
+ {
+ return BAD_REQUEST;
+ }
+}
+
+int main( int argc, char* argv[] )
+{
+ if( argc <= 2 )
+ {
+ printf("usage:%s ip_address port_number \n", basename(argv[0]));
+ return 1;
+ }
+ const char* ip = argv[1];
+ int port = atoi( argv[2] );
+ //创建一个IPv4 socket地址
+ struct sockaddr_in address;
+ bzero( &address, sizeof( address ) );
+ address.sin_family = AF_INET;
+ inet_pton( AF_INET, ip, &address.sin_addr );
+ address.sin_port = htons( port );
+
+ int listenfd = socket( PF_INET, SOCK_STREAM, 0);
+ assert( listenfd >= 0 );
+
+ int ret = bind(listenfd,(struct sockaddr*)&address, sizeof(address));
+ assert( ret != 1 );
+
+ ret = listen(listenfd,5);
+ assert( ret != 1 );
+
+ struct sockaddr_in client_address;
+ socklen_t client_addrlength = sizeof( client_address );
+ int connfd = accept( listenfd, (struct sockaddr*)&client_address, &client_addrlength);
+ if( fd < 0 )
+ {
+ printf("errno is: %d\n", errno);
+ }
+ else
+ {
+ char buffer[ BUFFER_SIZE ];//读缓冲区
+ memset( buffer, '\0', BUFFER_SIZE );
+ int data_read = 0;
+ int read_index = 0; //当前已经读取了多少字节的客户数据
+ int checked_index = 0; //当前已经分析完了多少字节的客户数据
+ int start_line = 0; //行在buffer中的起始位置
+ //设置主状态机的初始状态
+ CHECK_STATE checkstate = CHECK_STATE_REQUESTLINE;
+ while( 1 ) //循环读取客户数据并分析
+ {
+ data_read = recv( fd, buffer + read_index, BUFFER_SIZE - read_index, 0 );
+ if( data_read == -1 )
+ {
+ printf("reading failed\n");
+ break;
+ }
+ else if ( data_read == 0 )
+ {
+ printf("remote client has closed the connection \n");
+ break;
+ }
+ read_index += data_read;
+ //分析目前已经获取到的所有的客户数据
+ HTTP_CODE resutl = parse_content(buffer, checked_index, chectstate, read_index, start_line );
+ if( result == NO_REQUEST )//尚未得到一个完整的HTTP请求
+ {
+ continue;
+ }
+ else if ( result == GET_REQUEST )//得到一个完整的,正确的HTTP请求
+ {
+ send( fd, szret[0], strlen( szret[0] ), 0 );
+ break;
+ }
+ else //其他情况表示发生错误
+ {
+ send( fd, szret[1], strlen( szret[1] ), 0 );
+ break;
+ }
+ }
+ close( fd );
+ }
+ close( listenfd );
+ return 0;
+}
diff --git a/unix/intro/daytimetcpcli.c b/unix/intro/daytimetcpcli.c
new file mode 100644
index 0000000..ad15021
--- /dev/null
+++ b/unix/intro/daytimetcpcli.c
@@ -0,0 +1,31 @@
+#include "udp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd, n;
+ char recvline[MAXLINE + 1];
+ struct sockaddr_in servaddr;
+
+ if(argc != -2)
+ err_quit("usage:a.out");
+ if((sockfd = socket(AF_INET, SOCK_STREAM, 0 )) < 0)
+ err_sys("socket error");
+
+ bzero(&servaddr, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_port = htons(13); /*daytime server */
+ if(inet_pton(AF_INET, argv[1], &servaddr.sin_addr) <= 0)
+ err_quit("inet_pton error for %s", argv[1]);
+ if(connect(sockfd, (SA *) &servaddr, sizeof(servaddr)) < 0 )
+ err_sys("connect error");
+ while ((n = read(sockfd,recvline,MAXLINE)) > 0 ) {
+ recvline[n] = 0;/*null terminate */
+ if(fputs(recvline,stdout) == EOF)
+ err_sys("fputs error");
+ }
+
+ if(n<0)
+ err_sys("read error");
+ exit(0);
+}
\ No newline at end of file
diff --git a/unix/listen b/unix/listen
new file mode 100644
index 0000000..3acca24
Binary files /dev/null and b/unix/listen differ
diff --git a/unix/listenTest.cpp b/unix/listenTest.cpp
new file mode 100644
index 0000000..1b9d966
--- /dev/null
+++ b/unix/listenTest.cpp
@@ -0,0 +1,51 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+static bool stop = false;
+
+//SIGTERM 信号处理函数 触发式结束主程序循环
+
+static void handle_term(int sig)
+{
+ stop = true;
+}
+
+int main( int argc, char* argv[] )
+{
+ signal( SIGTERM,handle_term );
+
+ if( argc<=3 ){
+ printf("usage:%s ip_address port_number backlog\n", basename(argv[0]));
+ return 1;
+ }
+ const char* ip = argv[1];
+ int port = atoi( argv[2] );
+ int backlog = atoi( argv[3] );
+ int sock = socket( PF_INET,SOCK_STREAM, 0 );
+ assert(sock >= 0);
+ //创建一个IPv4 socket地址
+ struct sockaddr_in address;
+ bzero( &address, sizeof( address ) );
+ address.sin_family = AF_INET;
+ inet_pton( AF_INET, ip, &address.sin_addr );
+ address.sin_port = htons( port );
+ int ret = bind(sock,(struct sockaddr*)&address, sizeof(address));
+ assert( ret != 1 );
+ ret = listen(sock,backlog);
+ assert(ret != 1);
+ //循环等待链接,直到有SIGTERM信号将他中断
+ while( !stop ) {
+ sleep(1);
+ }
+ close( sock );
+ return 0;
+}
+
+
diff --git a/unix/qqClient.cpp b/unix/qqClient.cpp
new file mode 100644
index 0000000..1a2fa5a
--- /dev/null
+++ b/unix/qqClient.cpp
@@ -0,0 +1,86 @@
+#define _GNU_SOURCE 1
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define BUFFER_SIZE 64
+
+int main( int argc, char* argv[])
+{
+ if( argc <= 2 )
+ {
+ printf("usage:%s ip_address port_number\n", basename(argv[0]) );
+ return 1;
+ }
+ const char* ip = argv[1];
+ int port = atoi( argv[2] );
+
+ struct sockaddr_in address;
+ bzero(&address,sizeof(address));
+ address.sin_family = AF_INET;
+ inet_pton(AF_INET, ip, &address.sin_addr);
+ address.sin_port = htons(port);
+
+ int sockfd = socket(PF_INET, SOCK_STREAM, 0);
+ assert( sockfd >= 0 );
+ if( connect( sockfd, (struct sockaddr* )&server_address, sizeof( server_address )) < 0 )
+ {
+ printf("connection failed\n");
+ close( sockfd );
+ return 1;
+ }
+
+ pollfd fds[2];
+ /*注册文件描述符0(标准输入)和文件描述符sockfd上的可读事件*/
+ fds[0].fd = 0;
+ fds[0].events = POLLIN;
+ fds[0].revents = 0;
+ fds[1].fd = sockfd;
+ fds[1].events = POLLIN | POLLRDHUP;
+ fds[1].revents = 0;
+
+ char read_buf[BUFFER_SIZE];
+ int pipefd[2];
+ int ret = pipe( pipefd );
+ assert( ret != -1 );
+
+ while( 1 )
+ {
+ ret = poll( fds, 2, -1 );
+ if( ret < 0 )
+ {
+ printf("poll failure\n");
+ break;
+ }
+
+ if( fds[1].revents & POLLRDHUP )
+ {
+ printf("server close the connection\n");
+ break;
+ }
+ else if ( fds[1].revents & POLLIN )
+ {
+ memset(read_buf, '\0', BUFFER_SIZE);
+ recv(fds[1].fd, read_buf, BUFFER_SIZE - 1, 0 );
+ printf("%s\n", read_buf );
+ }
+
+ if(fds[0].revents & POLLIN)
+ {
+ /*使用splice将用户输入的数据直接写到sockfd上*/
+ ret = splice(0, NULL, pipefd[1], NULL, 32768, SPLICE_F_MORE | SPLICE_F_MOVE );
+ ret = splice(pipefd[0], NULL, sockfd , NULL, 32768, SPLICE_F_MORE | SPLICE_F_MOVE );
+ }
+ }
+
+ close( sockfd );
+ return 0;
+}
diff --git a/unix/qqServer.cpp b/unix/qqServer.cpp
new file mode 100644
index 0000000..9b56f94
--- /dev/null
+++ b/unix/qqServer.cpp
@@ -0,0 +1,75 @@
+#define _GNU_SOURCE 1
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define USER_LIMIT 5 /*最大用户数*/
+#define BUFFER_SIZE 64 /*读缓冲区的大小*/
+#define FD_LIMIT 65535 /*文件描述符数量限制*/
+
+/*客户数据:客户端socket地址、待写到客户端的数据的位置、从客户端读入的数据*/
+struct client_data
+{
+ sockaddr_in address;
+ char* write_buf;
+ char buf[ BUFFER_SIZE ];
+};
+
+int setnonblocking( int fd )
+{
+ int old_option = fcntl( fd, F_GETFL );
+ int new_option = old_option | O_NONBLOCK;
+ fcntl( fd, F_SETFL, new_option );
+ return old_option;
+}
+
+int main( int argc, char* argv[] )
+{
+ if( argc <= 2 )
+ {
+ printf("usage:%s ip_address port_number\n", basename(argv[0]) );
+ return 1;
+ }
+ const char* ip = argv[1];
+ int port = atoi( argv[2] );
+
+ struct sockaddr_in address;
+ bzero(&address,sizeof(address));
+ address.sin_family = AF_INET;
+ inet_pton(AF_INET, ip, &address.sin_addr);
+ address.sin_port = htons(port);
+
+ int listenfd = socket( PF_INET, SOCK_STREAM, 0 );
+ assert( listenfd >= 0 );
+
+ ret = bind( listenfd, ( struct sockaddr* )&address, sizeof( address ));
+ assert( ret != -1 );
+
+ ret = listen( listenfd, 5 );
+ assert( ret != -1 );
+
+ /*创建users数组,分配FD_LIMIT个client_data对象,可以预期:每个可能的socket链接都可以获得
+ 一个这样的对象,并且socket的值可以直接用来索引(作为数组的下标)socket链接对应的
+ client_data对象,这是将socket和客户数据关联的简单而高效的方法*/
+ client_data* users = new client_data[FD_LIMIT];
+ /*尽管我们分配了足够多的client_data对象,但为了提高poll的性能,仍然有必要限制用户的数量*/
+ pollfd fds[USER_LIMIT + 1];
+ int user_counter = 0;
+ for( ini i = 1; i <= USER_LIMIT; ++i )
+ {
+ fds[i].fd = -1;
+ fds[i].events = 0;
+ }
+ fds[0].fd = listenfd;
+ fds[0].events = POLLIN | POLLERR;
+ fds[0].revents = 0;
+
+}
diff --git a/unix/recvOob b/unix/recvOob
new file mode 100644
index 0000000..d215cb7
Binary files /dev/null and b/unix/recvOob differ
diff --git a/unix/recvOobTest.cpp b/unix/recvOobTest.cpp
new file mode 100644
index 0000000..03f2549
--- /dev/null
+++ b/unix/recvOobTest.cpp
@@ -0,0 +1,64 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define BUF_SIZE 1024
+
+int main( int argc, char* argv[] )
+{
+ if( argc <= 2 )
+ {
+ printf("usage:%s ip_address port_number\n", basename(argv[0]) );
+ return 1;
+ }
+ const char* ip = argv[1];
+ int port = atoi( argv[2] );
+
+ struct sockaddr_in address;
+ bzero(&address,sizeof(address));
+ address.sin_family = AF_INET;
+ inet_pton(AF_INET, ip, &address.sin_addr);
+ address.sin_port = htons(port);
+ int sock = socket(PF_INET, SOCK_STREAM, 0 );
+ assert( sock >= 0);
+
+ int ret = bind(sock, (struct sockaddr*)&address, sizeof(address));
+ assert( ret != 1);
+
+ ret = listen( sock, 5 );
+ assert( ret != 1);
+
+ struct sockaddr_in client;
+ socklen_t client_addrlength = sizeof( client );
+ int connfd = accept( sock, ( struct sockaddr* )&client, &client_addrlength );
+ if( connfd < 0 )
+ {
+ printf("errno is %d\n", errno);
+ }
+ else
+ {
+ char buffer[ BUF_SIZE ];
+
+ memset( buffer, '\0', BUF_SIZE);
+ ret = recv( connfd, buffer, BUF_SIZE-1, 0 );
+ printf("got %d bytes of normal data '%s'\n", ret, buffer);
+
+ memset( buffer, '\0', BUF_SIZE);
+ ret = recv( connfd, buffer, BUF_SIZE-1, MSG_OOB );
+ printf("got %d bytes of oob data '%s'\n", ret, buffer);
+
+ memset( buffer, '\0', BUF_SIZE);
+ ret = recv( connfd, buffer, BUF_SIZE-1, MSG_OOB );
+ printf("got %d bytes of normal data '%s'\n", ret, buffer);
+
+ close(sock);
+ return 0;
+ }
+}
\ No newline at end of file
diff --git a/unix/select.cpp b/unix/select.cpp
new file mode 100644
index 0000000..f6ef1d1
--- /dev/null
+++ b/unix/select.cpp
@@ -0,0 +1,94 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+int main(int argc, char* argv[])
+{
+ /* code */
+ if( argc <= 2 )
+ {
+ printf("usage:%s ip_address port_number\n", basename(argv[0]) );
+ return 1;
+ }
+ const char* ip = argv[1];
+ int port = atoi( argv[2] );
+
+ int ret = 0;
+ struct sockaddr_in address;
+ bzero( &address, sizeof( address ));
+ address.sin_family = AF_INET;
+ inet_pton( AF_INET, ip, &address.sin_addr );
+ address.sin_port = htons( port );
+
+ int listenfd = socket( PF_INET, SOCK_STREAM, 0 );
+ assert( listenfd >= 0 );
+ ret = bind(listenfd, (struct sockaddr*)&address, sizeof( address ));
+ assert( ret != -1 );
+ ret = listen( listenfd, 5);
+ assert( ret != -1 );
+
+ struct sockaddr_in client_address;
+ socklen_t client_addrlength = sizeof( client_address );
+ int connfd = accept( listenfd, ( struct sockaddr* )&client_address, &client_addrlength);
+ if( connfd < 0 )
+ {
+ printf("errno is : %d\n", errno);
+ close(listenfd);
+ }
+
+ char buf[1024];
+ fd_set read_fds;
+ fd_set exception_fds;
+ FD_ZERO( &read_fds );
+ FD_ZERO( &exception_fds );
+
+ while(1)
+ {
+ memset( buf, '\0', sizeof( buf ));
+ /** 每次调用select前都要重新再read_fds和excetpion_fds中设置文件描述符connfd,
+ 因为事件发生之后,文件描述符集合将被内核修改 */
+ FD_SET( connfd, &read_fds );
+ FD_SET( connfd, &exception_fds );
+ ret = select( connfd + 1, &read_fds, NULL, &exception_fds, NULL );
+ if( ret < 0 )
+ {
+ printf("selection failure\n");
+ break;
+ }
+
+ /** 对于可读事件,采用普通的recv函数读取数据 */
+ if( FD_ISSET( connfd, &read_fds ))
+ {
+ ret = recv( connfd, buf, sizeof( buf ) -1, 0 );
+ if( ret <=0 )
+ {
+ break;
+ }
+ printf( "get %d bytes of normal data: %s\n", ret, buf );
+
+ }
+ /* 对于异常事件,采用带msg_oob标志的recv函数读取带外数据 */
+ else if( FD_ISSET( connfd, &exception_fds ))
+ {
+ ret = recv( connfd, buf, sizeof( buf ) - 1, MSG_OOB );
+ if( ret <= 0 )
+ {
+ break;
+ }
+ printf("get %d bytes of oob data:%s\n", ret, buf );
+ }
+ close( connfd );
+ close( listenfd );
+ return 0;
+
+ }
+ return 0;
+}
\ No newline at end of file
diff --git a/unix/sendOob b/unix/sendOob
new file mode 100644
index 0000000..686a2a5
Binary files /dev/null and b/unix/sendOob differ
diff --git a/unix/sendOobTest.cpp b/unix/sendOobTest.cpp
new file mode 100644
index 0000000..602fb47
--- /dev/null
+++ b/unix/sendOobTest.cpp
@@ -0,0 +1,46 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+int main ( int argc, char* argv[] )
+{
+ if (argc <= 2)
+ {
+ printf("usage:%s ip_address port_number\n", basename(argv[0]) );
+ return 1;
+ }
+
+ const char* ip = argv[1];
+ int port = atoi( argv[2] );
+ struct sockaddr_in server_address;
+ bzero( &server_address, sizeof( server_address ) );
+ server_address.sin_family = AF_INET;
+ inet_pton( AF_INET, ip, &server_address.sin_addr );
+ server_address.sin_port = htons( port );
+
+ int sockfd = socket( PF_INET, SOCK_STREAM, 0);
+ assert( sockfd >= 0);
+
+ if(connect(sockfd,(struct sockaddr*)&server_address,sizeof(server_address)) < 0)
+ {
+ printf("connection failed\n");
+ }
+ else
+ {
+ const char* obb_data = "abc";
+ const char* normal_data = "123";
+ send( sockfd, normal_data, strlen( normal_data ),0);
+ send( sockfd, obb_data, strlen( obb_data ), MSG_OOB);
+ send( sockfd, normal_data, strlen(normal_data), 0);
+ }
+
+ close(sockfd);
+ return 0;
+
+}
\ No newline at end of file
diff --git a/unix/sendfile b/unix/sendfile
new file mode 100644
index 0000000..bfff190
Binary files /dev/null and b/unix/sendfile differ
diff --git a/unix/sendfile.cpp b/unix/sendfile.cpp
new file mode 100644
index 0000000..75e0eb1
--- /dev/null
+++ b/unix/sendfile.cpp
@@ -0,0 +1,64 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+
+int main( int argc, char* argv[] )
+{
+ if( argc <= 3)
+ {
+ printf("usage:%s ip_address port_number\n", basename(argv[0]) );
+ return 1;
+ }
+ const char* ip = argv[1];
+ int port = atoi( argv[2] );
+ //将目标文件作为程序的第三个参数传入
+ const char* file_name = argv[3];
+
+ int filefd = open(file_name,O_RDONLY);
+ assert( filefd > 0 );
+ struct stat stat_buf;
+ fstat( filefd, &stat_buf);
+
+ struct sockaddr_in address;
+ bzero( &address, sizeof( address ) );
+ address.sin_family = AF_INET;
+ inet_pton( AF_INET, ip, &address.sin_addr );
+ address.sin_port = htons( port );
+ int sock = socket( PF_INET, SOCK_STREAM, 0);
+ assert( sock >= 0 );
+
+
+ int ret = bind(sock,(struct sockaddr*)&address, sizeof(address));
+ assert( ret != 1 );
+
+ ret = listen(sock,5);
+ assert( ret != 1 );
+
+ struct sockaddr_in client;
+ socklen_t client_addrlength = sizeof( client );
+ int connfd = accept( sock, (struct sockaddr*)&client, &client_addrlength);
+ if( connfd < 0 )
+ {
+ printf("errno is:%d\n",errno);
+ }
+ else
+ {
+ sendfile( connfd, filefd, NULL, stat_buf.st_size);
+ }
+
+ close( sock );
+ return 0;
+}
\ No newline at end of file
diff --git a/unix/splice.cpp b/unix/splice.cpp
new file mode 100644
index 0000000..a403841
--- /dev/null
+++ b/unix/splice.cpp
@@ -0,0 +1,63 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define BUF_SIZE 1024
+
+int main( int argc, char* argv[] )
+{
+ if( argc <= 2 )
+ {
+ printf("usage:%s ip_address port_number\n", basename(argv[0]) );
+ return 1;
+ }
+ const char* ip = argv[1];
+ int port = atoi( argv[2] );
+
+ struct sockaddr_in address;
+ bzero(&address,sizeof(address));
+ address.sin_family = AF_INET;
+ inet_pton(AF_INET, ip, &address.sin_addr);
+ address.sin_port = htons(port);
+
+ int sock = socket(PF_INET, SOCK_STREAM, 0 );
+ assert( sock >= 0);
+
+ int ret = bind(sock, (struct sockaddr*)&address, sizeof(address));
+ assert( ret != 1);
+
+ ret = listen( sock, 5 );
+ assert( ret != 1);
+
+ struct sockaddr_in client;
+ socklen_t client_addrlength = sizeof( client );
+ int connfd = accept( sock, ( struct sockaddr* )&client, &client_addrlength );
+
+ if( connfd < 0 )
+ {
+ printf("errno is %d\n", errno);
+ }
+ else
+ {
+ int pipefd[2];
+ assert( ret != -1 );
+ ret = pipe( pipefd );//创建管道
+ //将connfd上流入的客户数据定向到管道中
+ ret = splice( connfd, NULL, pipefd[1], NULL, 32768, SPLICE_F_MORE | SPLICE_F_MOVE );
+ assert( ret != -1 );
+ //将管道的输出定向到connfd客户链接文件描述符
+ ret = splice( pipefd[0], NULL, connfd, NULL, 32768, SPLICE_F_MORE | SPLICE_F_MOVE );
+ assert( ret != -1 );
+ close(connfd);
+
+ }
+ close( sock );
+ return 0 ;
+}
\ No newline at end of file
diff --git a/unix/unpv13e/DISCLAIMER b/unix/unpv13e/DISCLAIMER
new file mode 100644
index 0000000..e24e4a8
--- /dev/null
+++ b/unix/unpv13e/DISCLAIMER
@@ -0,0 +1,11 @@
+ LIMITS OF LIABILITY AND DISCLAIMER OF WARRANTY
+
+The authors and publisher of the book "UNIX Network Programming" have
+used their best efforts in preparing this software. These efforts
+include the development, research, and testing of the theories and
+programs to determine their effectiveness. The authors and publisher
+make no warranty of any kind, express or implied, with regard to
+these programs or the documentation contained in the book. The authors
+and publisher shall not be liable in any event for incidental or
+consequential damages in connection with, or arising out of, the
+furnishing, performance, or use of these programs.
diff --git a/unix/unpv13e/Make.defines.in b/unix/unpv13e/Make.defines.in
new file mode 100644
index 0000000..ce542a9
--- /dev/null
+++ b/unix/unpv13e/Make.defines.in
@@ -0,0 +1,41 @@
+#
+# This file is generated by autoconf from "Make.defines.in".
+#
+# This is the "Make.defines" file that almost every "Makefile" in the
+# source directories below this directory include.
+# The "../" in the pathnames actually refer to this directory, since
+# "make" is executed in all the subdirectories of this directory.
+#
+# System = @host@
+
+CC = @CC@
+CFLAGS = -I../lib @CFLAGS@
+LIBS = @LIBUNP@ @LIBS@
+LIBS_XTI = @LIBUNPXTI@ @LIBUNP@ @LIBS_XTI@
+RANLIB = @RANLIB@
+
+# Following is the main library, built from all the object files
+# in the lib/ and libfree/ directories.
+LIBUNP_NAME = @LIBUNP_NAME@
+
+# Following is the XTI library, built from all the object files
+# in the libxti/ directory.
+LIBUNPXTI_NAME = @LIBUNPXTI_NAME@
+
+# Following are all the object files to create in the lib/ directory.
+LIB_OBJS = @LIB_OBJS@
+
+# Following are all the object files to create in the libfree/ directory.
+LIBFREE_OBJS = @LIBFREE_OBJS@
+
+# Following are all the object files to create in the libgai/ directory.
+LIBGAI_OBJS = @LIBGAI_OBJS@
+
+# Following are all the object files to create in the libroute/ directory.
+LIBROUTE_OBJS = @LIBROUTE_OBJS@
+
+# Following are all the object files to create in the libxti/ directory.
+LIBXTI_OBJS = @LIBXTI_OBJS@
+
+CLEANFILES = core core.* *.core *.o temp.* *.out typescript* \
+ *.lc *.lh *.bsdi *.sparc *.uw
diff --git a/unix/unpv13e/Makefile.in b/unix/unpv13e/Makefile.in
new file mode 100644
index 0000000..452f73e
--- /dev/null
+++ b/unix/unpv13e/Makefile.in
@@ -0,0 +1,11 @@
+include ./Make.defines
+
+all:
+ @echo "Nothing to make in this directory"
+ @echo "Please read the README file"
+
+clean:
+ rm -f $(CLEANFILES)
+
+distclean:
+ rm -f $(CLEANFILES) config.cache config.log config.status config.h Make.defines Makefile
diff --git a/unix/unpv13e/README b/unix/unpv13e/README
new file mode 100644
index 0000000..b760854
--- /dev/null
+++ b/unix/unpv13e/README
@@ -0,0 +1,115 @@
+QUICK AND DIRTY
+===============
+
+Execute the following from the src/ directory:
+
+ ./configure # try to figure out all implementation differences
+
+ cd lib # build the basic library that all programs need
+ make # use "gmake" everywhere on BSD/OS systems
+
+ cd ../libfree # continue building the basic library
+ make
+
+ cd ../libroute # only if your system supports 4.4BSD style routing sockets
+ make # only if your system supports 4.4BSD style routing sockets
+
+ cd ../libxti # only if your system supports XTI
+ make # only if your system supports XTI
+
+ cd ../intro # build and test a basic client program
+ make daytimetcpcli
+ ./daytimetcpcli 127.0.0.1
+
+If all that works, you're all set to start compiling individual programs.
+
+Notice that all the source code assumes tabs every 4 columns, not 8.
+
+MORE DETAILS
+============
+
+5. If you need to make any changes to the "unp.h" header, notice that it
+ is a hard link in each directory, so you only need to change it once.
+
+6. Go into the "lib/" directory and type "make". This builds the library
+ "libunp.a" that is required by almost all of the programs. There may
+ be compiler warnings (see NOTES below). This step is where you'll find
+ all of your system's dependencies, and you must just update your cf/
+ files from step 1, rerun "config" and do this step again.
+
+6. Go into the "libfree/" directory and type "make". This adds to the
+ "libunp.a" library. The files in this directory do not #include
+ the "unp.h" header, as people may want to use these functions
+ independent of the book's examples.
+
+8. Once the library is made from steps 5 and 6, you can then go into any
+ of the source code directories and make whatever program you are
+ interested in. Note that the horizontal rules at the beginning and
+ end of each program listing in the book contain the directory name and
+ filename.
+
+ BEWARE: Not all programs in each directory will compile on all systems
+ (e.g., the file src/advio/recvfromflags.c will not compile unless your
+ system supports the IP_RECVDSTADDR socket option). Also, not all files
+ in each directory are included in the book. Beware of any files with
+ "test" in the filename: they are probably a quick test program that I
+ wrote to check something, and may or may not work.
+
+NOTES
+-----
+
+- Many systems do not have correct function prototypes for the socket
+ functions, and this can cause many warnings during compilation.
+ For example, Solaris 2.5 omits the "const" from the 2nd argument
+ to connect(). Lots of systems use "int" for the length of socket
+ address structures, while Posix.1g specifies "size_t". Lots of
+ systems still have the pointer argument to [sg]etsockopt() as a
+ "char *" instead of a "void *", and this also causes warnings.
+
+- SunOS 4.1.x: If you are using Sun's acc compiler, you need to run
+ the configure program as
+
+ CC=acc CFLAGS=-w CPPFLAGS=-w ./configure
+
+ Failure to do this results in numerous system headers ()
+ not being found during configuration, causing compile errors later.
+
+- If your system supports IPv6 and you want to run the examples in the
+ book using hostnames, you must install the latest BIND release. You
+ can get it from ftp://ftp.vix.com/pub/bind/release. All you need from
+ this release is a resolver library that you should then add to the
+ LDLIBS and LDLIBS_THREADS lines.
+
+- IPv6 support is still in its infancy. There may be differences
+ between the IPv6 sockets API specifications and what the vendor
+ provides. This may require hand tweaking, but should get better
+ over time.
+
+- If your system supports an older draft of the Posix pthreads standard,
+ but configure detects the support of pthreads, you will have to disable
+ this by hand. Digital Unix V3.2C has this problem, for example, as it
+ supports draft 4, not the final draft.
+
+ To fix this, remove wrappthread.o from LIB_OBJS in "Make.defines" and
+ don't try to build and run any of the threads programs.
+
+COMMON DIFFERENCES
+------------------
+
+These are the common differences that I see in various headers that are
+not "yet" at the level of Posix.1g or X/Open XNS Issue 5.
+
+- getsockopt() and setsockopt(): 5th argument is not correct type.
+
+- t_bind(): second argument is missing "const".
+
+- t_connect(): second argument is missing "const".
+
+- t_open(): first argument is missing "const".
+
+- t_optmsmg(): second argument is missing "const".
+
+- If your defines the members of the t_opthdr{} as longs,
+ instead of t_uscalar_t, some of the printf formats of these value
+ might generate warnings from your compiler, since you are printing
+ a long without a corresponding long format specifier.
diff --git a/unix/unpv13e/VERSION b/unix/unpv13e/VERSION
new file mode 100644
index 0000000..021f875
--- /dev/null
+++ b/unix/unpv13e/VERSION
@@ -0,0 +1 @@
+2004/12/12
diff --git a/unix/unpv13e/aclocal.m4 b/unix/unpv13e/aclocal.m4
new file mode 100644
index 0000000..2a62037
--- /dev/null
+++ b/unix/unpv13e/aclocal.m4
@@ -0,0 +1,213 @@
+dnl ##################################################################
+dnl Our macro to check for a function prototype in a given header.
+dnl
+AC_DEFUN(AC_CHECK_FUNC_PROTO,
+ [AC_CACHE_CHECK(for $1 function prototype in $2, ac_cv_have_$1_proto,
+ AC_EGREP_HEADER($1, $2,
+ ac_cv_have_$1_proto=yes,
+ ac_cv_have_$1_proto=no))
+ if test $ac_cv_have_$1_proto = yes ; then
+ ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`_PROTO
+ AC_DEFINE_UNQUOTED($ac_tr_func)
+ fi
+])
+
+dnl ##################################################################
+dnl We cannot use the AC_CHECK_TYPE macros because AC_CHECK_TYPE
+dnl #includes only , , and .
+dnl Unfortunately, many implementations today hide typedefs in wierd
+dnl locations: Solaris 2.5.1 has uint8_t and uint32_t in .
+dnl SunOS 4.1.x has int8_t in .
+dnl So we define our own macro AC_UNP_CHECK_TYPE that does the same
+dnl #includes as "unp.h", and then looks for the typedef.
+dnl
+dnl This macro should be invoked after all the header checks have been
+dnl performed, since we #include "confdefs.h" below, and then use the
+dnl HAVE_foo_H values that it can #define.
+dnl
+AC_DEFUN(AC_UNP_CHECK_TYPE,
+ [AC_MSG_CHECKING(if $1 defined)
+ AC_CACHE_VAL(ac_cv_type_$1,
+ AC_TRY_COMPILE(
+[
+#include "confdefs.h" /* the header built by configure so far */
+#ifdef HAVE_SYS_TYPES_H
+# include
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+# include
+#endif
+#ifdef HAVE_SYS_TIME_H
+# include
+#endif
+#ifdef HAVE_NETINET_IN_H
+# include
+#endif
+#ifdef HAVE_ARPA_INET_H
+# include
+#endif
+#ifdef HAVE_ERRNO_H
+# include
+#endif
+#ifdef HAVE_FCNTL_H
+# include
+#endif
+#ifdef HAVE_NETDB_H
+# include
+#endif
+#ifdef HAVE_SIGNAL_H
+# include
+#endif
+#ifdef HAVE_STDIO_H
+# include
+#endif
+#ifdef HAVE_STDLIB_H
+# include
+#endif
+#ifdef HAVE_STRING_H
+# include
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include
+#endif
+#ifdef HAVE_SYS_UIO_H
+# include
+#endif
+#ifdef HAVE_UNISTD_H
+# include
+#endif
+#ifdef HAVE_SYS_WAIT_H
+# include
+#endif
+#ifdef HAVE_SYS_UN_H
+# include
+#endif
+#ifdef HAVE_SYS_SELECT_H
+# include
+#endif
+#ifdef HAVE_STRINGS_H
+# include
+#endif
+#ifdef HAVE_SYS_IOCTL_H
+# include
+#endif
+#ifdef HAVE_SYS_FILIO_H
+# include
+#endif
+#ifdef HAVE_SYS_SOCKIO_H
+# include
+#endif
+#ifdef HAVE_PTHREAD_H
+# include
+#endif],
+ [ $1 foo ],
+ ac_cv_type_$1=yes,
+ ac_cv_type_$1=no))
+ AC_MSG_RESULT($ac_cv_type_$1)
+ if test $ac_cv_type_$1 = no ; then
+ AC_DEFINE($1, $2, $3)
+ fi
+])
+
+dnl ##################################################################
+dnl The following checks for any typedefs for XTI programs.
+dnl We perform all the #includes that "libxti/unpxti.h" performs.
+dnl
+AC_DEFUN(AC_UNPXTI_CHECK_TYPE,
+ [AC_MSG_CHECKING(if $1 defined)
+ AC_CACHE_VAL(ac_cv_type_$1,
+ AC_TRY_COMPILE(
+[
+#include "confdefs.h" /* the header built by configure so far */
+#ifdef HAVE_SYS_TYPES_H
+# include
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+# include
+#endif
+#ifdef HAVE_SYS_TIME_H
+# include
+#endif
+#ifdef HAVE_NETINET_IN_H
+# include
+#endif
+#ifdef HAVE_ARPA_INET_H
+# include
+#endif
+#ifdef HAVE_ERRNO_H
+# include
+#endif
+#ifdef HAVE_FCNTL_H
+# include
+#endif
+#ifdef HAVE_NETDB_H
+# include
+#endif
+#ifdef HAVE_SIGNAL_H
+# include
+#endif
+#ifdef HAVE_STDIO_H
+# include
+#endif
+#ifdef HAVE_STDLIB_H
+# include
+#endif
+#ifdef HAVE_STRING_H
+# include
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include
+#endif
+#ifdef HAVE_SYS_UIO_H
+# include
+#endif
+#ifdef HAVE_UNISTD_H
+# include
+#endif
+#ifdef HAVE_SYS_WAIT_H
+# include
+#endif
+#ifdef HAVE_SYS_UN_H
+# include
+#endif
+#ifdef HAVE_SYS_SELECT_H
+# include
+#endif
+#ifdef HAVE_STRINGS_H
+# include
+#endif
+#ifdef HAVE_SYS_IOCTL_H
+# include
+#endif
+#ifdef HAVE_SYS_FILIO_H
+# include
+#endif
+#ifdef HAVE_SYS_SOCKIO_H
+# include
+#endif
+#ifdef HAVE_PTHREAD_H
+# include
+#endif
+#ifdef HAVE_POLL_H
+# include
+#endif
+#ifdef HAVE_XTI_H
+# include
+#endif
+#ifdef HAVE_NETCONFIG_H
+# include
+#endif
+#ifdef HAVE_NETDIR_H
+# include
+#endif
+#ifdef HAVE_STROPTS_H
+# include
+#endif],
+ [ $1 foo ],
+ ac_cv_type_$1=yes,
+ ac_cv_type_$1=no))
+ AC_MSG_RESULT($ac_cv_type_$1)
+ if test $ac_cv_type_$1 = no ; then
+ AC_DEFINE($1, $2, $3)
+ fi
+])
diff --git a/unix/unpv13e/advio/Makefile b/unix/unpv13e/advio/Makefile
new file mode 100644
index 0000000..54a9ba6
--- /dev/null
+++ b/unix/unpv13e/advio/Makefile
@@ -0,0 +1,54 @@
+include ../Make.defines
+
+PROGS = tcpcli01 tcpcli02 tcpserv02 \
+ udpcli01 udpcli02 udpcli03 \
+ udpserv01 udpserv03 udpserv04 \
+ daytimetcpcli daytimeudpcli3 daytimeudpcli4
+
+all: ${PROGS}
+
+tcpcli01: tcpcli01.o
+ ${CC} ${CFLAGS} -o $@ tcpcli01.o ${LIBS}
+
+tcpcli02: tcpcli02.o str_cli_select02.o
+ ${CC} ${CFLAGS} -o $@ tcpcli02.o str_cli_select02.o ${LIBS}
+
+tcpcli03: tcpcli03.o str_cli_poll03.o
+ ${CC} ${CFLAGS} -o $@ tcpcli03.o str_cli_poll03.o ${LIBS}
+
+tcpcli04: tcpcli04.o str_cli_kqueue04.o
+ ${CC} ${CFLAGS} -o $@ tcpcli04.o str_cli_kqueue04.o ${LIBS}
+
+tcpserv02: tcpserv02.o str_echo_stdio02.o sig_chld_waitpid.o
+ ${CC} ${CFLAGS} -o $@ tcpserv02.o str_echo_stdio02.o \
+ sig_chld_waitpid.o ${LIBS}
+
+udpcli01: udpcli01.o dgclitimeo1.o
+ ${CC} ${CFLAGS} -o $@ udpcli01.o dgclitimeo1.o ${LIBS}
+
+udpcli02: udpcli02.o dgclitimeo2.o
+ ${CC} ${CFLAGS} -o $@ udpcli02.o dgclitimeo2.o ${LIBS}
+
+udpcli03: udpcli03.o dgclitimeo3.o
+ ${CC} ${CFLAGS} -o $@ udpcli03.o dgclitimeo3.o ${LIBS}
+
+udpserv01: udpserv01.o dgechoaddr.o recvfromflags.o
+ ${CC} ${CFLAGS} -o $@ udpserv01.o dgechoaddr.o recvfromflags.o ${LIBS}
+
+udpserv03: udpserv03.o
+ ${CC} ${CFLAGS} -o $@ udpserv03.o ${LIBS}
+
+udpserv04: udpserv04.o
+ ${CC} ${CFLAGS} -o $@ udpserv04.o ${LIBS}
+
+daytimetcpcli: daytimetcpcli.o
+ ${CC} ${CFLAGS} -o $@ daytimetcpcli.o ${LIBS}
+
+daytimeudpcli3: daytimeudpcli3.o
+ ${CC} ${CFLAGS} -o $@ daytimeudpcli3.o ${LIBS}
+
+daytimeudpcli4: daytimeudpcli4.o
+ ${CC} ${CFLAGS} -o $@ daytimeudpcli4.o ${LIBS}
+
+clean:
+ rm -f ${PROGS} ${CLEANFILES}
diff --git a/unix/unpv13e/advio/daytimetcpcli.c b/unix/unpv13e/advio/daytimetcpcli.c
new file mode 100644
index 0000000..7b4dcab
--- /dev/null
+++ b/unix/unpv13e/advio/daytimetcpcli.c
@@ -0,0 +1,32 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd, n, npend;
+ char recvline[MAXLINE + 1];
+ socklen_t len;
+ struct sockaddr_storage ss;
+
+ if (argc != 3)
+ err_quit("usage: a.out ");
+
+ sockfd = Tcp_connect(argv[1], argv[2]);
+
+ len = sizeof(ss);
+ Getpeername(sockfd, (SA *)&ss, &len);
+ printf("connected to %s\n", Sock_ntop_host((SA *)&ss, len));
+
+ for ( ; ; ) {
+ if ( (n = Recv(sockfd, recvline, MAXLINE, MSG_PEEK)) == 0)
+ break; /* server closed connection */
+
+ Ioctl(sockfd, FIONREAD, &npend); /* check FIONREAD support */
+ printf("%d bytes from PEEK, %d bytes pending\n", n, npend);
+
+ n = Read(sockfd, recvline, MAXLINE);
+ recvline[n] = 0; /* null terminate */
+ Fputs(recvline, stdout);
+ }
+ exit(0);
+}
diff --git a/unix/unpv13e/advio/daytimeudpcli3.c b/unix/unpv13e/advio/daytimeudpcli3.c
new file mode 100644
index 0000000..29da552
--- /dev/null
+++ b/unix/unpv13e/advio/daytimeudpcli3.c
@@ -0,0 +1,30 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd, n, nq;
+ char recvline[MAXLINE + 1];
+ socklen_t salen;
+ struct sockaddr *sa;
+
+ if (argc != 3)
+ err_quit("usage: a.out ");
+
+ sockfd = Udp_client(argv[1], argv[2], (void **) &sa, &salen);
+
+ printf("sending to %s\n", Sock_ntop_host(sa, salen));
+
+ Sendto(sockfd, "", 1, 0, sa, salen); /* send 1-byte datagram */
+
+ n = Recvfrom(sockfd, recvline, MAXLINE, MSG_PEEK, NULL, NULL);
+
+ Ioctl(sockfd, FIONREAD, &nq); /* check FIONREAD support */
+ printf("%d bytes from PEEK, %d bytes pending\n", n, nq);
+
+ n = Recvfrom(sockfd, recvline, MAXLINE, 0, NULL, NULL);
+ recvline[n] = 0; /* null terminate */
+ Fputs(recvline, stdout);
+
+ exit(0);
+}
diff --git a/unix/unpv13e/advio/daytimeudpcli4.c b/unix/unpv13e/advio/daytimeudpcli4.c
new file mode 100644
index 0000000..3e47bd1
--- /dev/null
+++ b/unix/unpv13e/advio/daytimeudpcli4.c
@@ -0,0 +1,32 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd, n, nq;
+ char recvline[MAXLINE + 1];
+ socklen_t len;
+ struct sockaddr_storage ss;
+
+ if (argc != 3)
+ err_quit("usage: a.out ");
+
+ sockfd = Udp_connect(argv[1], argv[2]);
+
+ len = sizeof(ss);
+ Getpeername(sockfd, (SA *)&ss, &len);
+ printf("connected to %s\n", Sock_ntop_host((SA *)&ss, len));
+
+ Write(sockfd, "", 2); /* send 1-byte datagram */
+
+ n = Recv(sockfd, recvline, MAXLINE, MSG_PEEK);
+
+ Ioctl(sockfd, FIONREAD, &nq); /* check FIONREAD support */
+ printf("%d bytes from PEEK, %d bytes pending\n", n, nq);
+
+ n = Read(sockfd, recvline, MAXLINE);
+ recvline[n] = 0; /* null terminate */
+ Fputs(recvline, stdout);
+
+ exit(0);
+}
diff --git a/unix/unpv13e/advio/dgclitimeo.c b/unix/unpv13e/advio/dgclitimeo.c
new file mode 100644
index 0000000..48702ba
--- /dev/null
+++ b/unix/unpv13e/advio/dgclitimeo.c
@@ -0,0 +1,22 @@
+#include "unp.h"
+
+void
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
+{
+ int n;
+ char sendline[MAXLINE], recvline[MAXLINE + 1];
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {
+
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
+
+ if (Readable_timeo(sockfd, 5) == 0) {
+ fprintf(stderr, "socket timeout\n");
+ continue;
+ }
+ n = Recvfrom(sockfd, recvline, MAXLINE, 0, NULL, NULL);
+
+ recvline[n] = 0; /* null terminate */
+ Fputs(recvline, stdout);
+ }
+}
diff --git a/unix/unpv13e/advio/dgclitimeo1.c b/unix/unpv13e/advio/dgclitimeo1.c
new file mode 100644
index 0000000..9cf1622
--- /dev/null
+++ b/unix/unpv13e/advio/dgclitimeo1.c
@@ -0,0 +1,21 @@
+#include "unp.h"
+
+void
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
+{
+ int n;
+ char sendline[MAXLINE], recvline[MAXLINE + 1];
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {
+
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
+
+ if (Readable_timeo(sockfd, 5) == 0) {
+ fprintf(stderr, "socket timeout\n");
+ } else {
+ n = Recvfrom(sockfd, recvline, MAXLINE, 0, NULL, NULL);
+ recvline[n] = 0; /* null terminate */
+ Fputs(recvline, stdout);
+ }
+ }
+}
diff --git a/unix/unpv13e/advio/dgclitimeo2.c b/unix/unpv13e/advio/dgclitimeo2.c
new file mode 100644
index 0000000..8f258a3
--- /dev/null
+++ b/unix/unpv13e/advio/dgclitimeo2.c
@@ -0,0 +1,30 @@
+#include "unp.h"
+
+void
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
+{
+ int n;
+ char sendline[MAXLINE], recvline[MAXLINE + 1];
+ struct timeval tv;
+
+ tv.tv_sec = 5;
+ tv.tv_usec = 0;
+ Setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {
+
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
+
+ n = recvfrom(sockfd, recvline, MAXLINE, 0, NULL, NULL);
+ if (n < 0) {
+ if (errno == EWOULDBLOCK) {
+ fprintf(stderr, "socket timeout\n");
+ continue;
+ } else
+ err_sys("recvfrom error");
+ }
+
+ recvline[n] = 0; /* null terminate */
+ Fputs(recvline, stdout);
+ }
+}
diff --git a/unix/unpv13e/advio/dgclitimeo2.lc b/unix/unpv13e/advio/dgclitimeo2.lc
new file mode 100644
index 0000000..cd6002e
--- /dev/null
+++ b/unix/unpv13e/advio/dgclitimeo2.lc
@@ -0,0 +1,30 @@
+#include "unp.h"## 1 ##src/advio/dgclitimeo2.c##
+
+void## 2 ##src/advio/dgclitimeo2.c##
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)## 3 ##src/advio/dgclitimeo2.c##
+{## 4 ##src/advio/dgclitimeo2.c##
+ int n;## 5 ##src/advio/dgclitimeo2.c##
+ char sendline[MAXLINE], recvline[MAXLINE + 1];## 6 ##src/advio/dgclitimeo2.c##
+ struct timeval tv;## 7 ##src/advio/dgclitimeo2.c##
+
+ tv.tv_sec = 5;## 8 ##src/advio/dgclitimeo2.c##
+ tv.tv_usec = 0;## 9 ##src/advio/dgclitimeo2.c##
+ Setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));## 10 ##src/advio/dgclitimeo2.c##
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {## 11 ##src/advio/dgclitimeo2.c##
+
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);## 12 ##src/advio/dgclitimeo2.c##
+
+ n = recvfrom(sockfd, recvline, MAXLINE, 0, NULL, NULL);## 13 ##src/advio/dgclitimeo2.c##
+ if (n < 0) {## 14 ##src/advio/dgclitimeo2.c##
+ if (errno == EWOULDBLOCK) {## 15 ##src/advio/dgclitimeo2.c##
+ fprintf(stderr, "socket timeout\n");## 16 ##src/advio/dgclitimeo2.c##
+ continue;## 17 ##src/advio/dgclitimeo2.c##
+ } else## 18 ##src/advio/dgclitimeo2.c##
+ err_sys("recvfrom error");## 19 ##src/advio/dgclitimeo2.c##
+ }## 20 ##src/advio/dgclitimeo2.c##
+
+ recvline[n] = 0; /* null terminate */## 21 ##src/advio/dgclitimeo2.c##
+ Fputs(recvline, stdout);## 22 ##src/advio/dgclitimeo2.c##
+ }## 23 ##src/advio/dgclitimeo2.c##
+}## 24 ##src/advio/dgclitimeo2.c##
diff --git a/unix/unpv13e/advio/dgclitimeo3.c b/unix/unpv13e/advio/dgclitimeo3.c
new file mode 100644
index 0000000..ff32f18
--- /dev/null
+++ b/unix/unpv13e/advio/dgclitimeo3.c
@@ -0,0 +1,35 @@
+#include "unp.h"
+
+static void sig_alrm(int);
+
+void
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
+{
+ int n;
+ char sendline[MAXLINE], recvline[MAXLINE + 1];
+
+ Signal(SIGALRM, sig_alrm);
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {
+
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
+
+ alarm(5);
+ if ( (n = recvfrom(sockfd, recvline, MAXLINE, 0, NULL, NULL)) < 0) {
+ if (errno == EINTR)
+ fprintf(stderr, "socket timeout\n");
+ else
+ err_sys("recvfrom error");
+ } else {
+ alarm(0);
+ recvline[n] = 0; /* null terminate */
+ Fputs(recvline, stdout);
+ }
+ }
+}
+
+static void
+sig_alrm(int signo)
+{
+ return; /* just interrupt the recvfrom() */
+}
diff --git a/unix/unpv13e/advio/dgclitimeo3.lc b/unix/unpv13e/advio/dgclitimeo3.lc
new file mode 100644
index 0000000..5fd7153
--- /dev/null
+++ b/unix/unpv13e/advio/dgclitimeo3.lc
@@ -0,0 +1,35 @@
+#include "unp.h"## 1 ##src/advio/dgclitimeo3.c##
+
+static void sig_alrm(int);## 2 ##src/advio/dgclitimeo3.c##
+
+void## 3 ##src/advio/dgclitimeo3.c##
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)## 4 ##src/advio/dgclitimeo3.c##
+{## 5 ##src/advio/dgclitimeo3.c##
+ int n;## 6 ##src/advio/dgclitimeo3.c##
+ char sendline[MAXLINE], recvline[MAXLINE + 1];## 7 ##src/advio/dgclitimeo3.c##
+
+ Signal(SIGALRM, sig_alrm);## 8 ##src/advio/dgclitimeo3.c##
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {## 9 ##src/advio/dgclitimeo3.c##
+
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);## 10 ##src/advio/dgclitimeo3.c##
+
+ alarm(5);## 11 ##src/advio/dgclitimeo3.c##
+ if ((n = recvfrom(sockfd, recvline, MAXLINE, 0, NULL, NULL)) < 0) {## 12 ##src/advio/dgclitimeo3.c##
+ if (errno == EINTR)## 13 ##src/advio/dgclitimeo3.c##
+ fprintf(stderr, "socket timeout\n");## 14 ##src/advio/dgclitimeo3.c##
+ else## 15 ##src/advio/dgclitimeo3.c##
+ err_sys("recvfrom error");## 16 ##src/advio/dgclitimeo3.c##
+ } else {## 17 ##src/advio/dgclitimeo3.c##
+ alarm(0);## 18 ##src/advio/dgclitimeo3.c##
+ recvline[n] = 0; /* null terminate */## 19 ##src/advio/dgclitimeo3.c##
+ Fputs(recvline, stdout);## 20 ##src/advio/dgclitimeo3.c##
+ }## 21 ##src/advio/dgclitimeo3.c##
+ }## 22 ##src/advio/dgclitimeo3.c##
+}## 23 ##src/advio/dgclitimeo3.c##
+
+static void## 24 ##src/advio/dgclitimeo3.c##
+sig_alrm(int signo)## 25 ##src/advio/dgclitimeo3.c##
+{## 26 ##src/advio/dgclitimeo3.c##
+ return; /* just interrupt the recvfrom() */## 27 ##src/advio/dgclitimeo3.c##
+}## 28 ##src/advio/dgclitimeo3.c##
diff --git a/unix/unpv13e/advio/dgechoaddr.c b/unix/unpv13e/advio/dgechoaddr.c
new file mode 100644
index 0000000..b8ab892
--- /dev/null
+++ b/unix/unpv13e/advio/dgechoaddr.c
@@ -0,0 +1,56 @@
+#include "unpifi.h"
+
+#undef MAXLINE
+#define MAXLINE 20 /* to see datagram truncation */
+
+void
+dg_echo(int sockfd, SA *pcliaddr, socklen_t clilen)
+{
+ int flags;
+ const int on = 1;
+ socklen_t len;
+ ssize_t n;
+ char mesg[MAXLINE], str[INET6_ADDRSTRLEN],
+ ifname[IFNAMSIZ];
+ struct in_addr in_zero;
+ struct unp_in_pktinfo pktinfo;
+
+#ifdef IP_RECVDSTADDR
+ if (setsockopt(sockfd, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on)) < 0)
+ err_ret("setsockopt of IP_RECVDSTADDR");
+#endif
+#ifdef IP_RECVIF
+ if (setsockopt(sockfd, IPPROTO_IP, IP_RECVIF, &on, sizeof(on)) < 0)
+ err_ret("setsockopt of IP_RECVIF");
+#endif
+ bzero(&in_zero, sizeof(struct in_addr)); /* all 0 IPv4 address */
+
+ for ( ; ; ) {
+ len = clilen;
+ flags = 0;
+ n = Recvfrom_flags(sockfd, mesg, MAXLINE, &flags,
+ pcliaddr, &len, &pktinfo);
+ printf("%d-byte datagram from %s", n, Sock_ntop(pcliaddr, len));
+ if (memcmp(&pktinfo.ipi_addr, &in_zero, sizeof(in_zero)) != 0)
+ printf(", to %s", Inet_ntop(AF_INET, &pktinfo.ipi_addr,
+ str, sizeof(str)));
+ if (pktinfo.ipi_ifindex > 0)
+ printf(", recv i/f = %s",
+ If_indextoname(pktinfo.ipi_ifindex, ifname));
+#ifdef MSG_TRUNC
+ if (flags & MSG_TRUNC) printf(" (datagram truncated)");
+#endif
+#ifdef MSG_CTRUNC
+ if (flags & MSG_CTRUNC) printf(" (control info truncated)");
+#endif
+#ifdef MSG_BCAST
+ if (flags & MSG_BCAST) printf(" (broadcast)");
+#endif
+#ifdef MSG_MCAST
+ if (flags & MSG_MCAST) printf(" (multicast)");
+#endif
+ printf("\n");
+
+ Sendto(sockfd, mesg, n, 0, pcliaddr, len);
+ }
+}
diff --git a/unix/unpv13e/advio/dgechoaddr.lc b/unix/unpv13e/advio/dgechoaddr.lc
new file mode 100644
index 0000000..2e445a3
--- /dev/null
+++ b/unix/unpv13e/advio/dgechoaddr.lc
@@ -0,0 +1,59 @@
+#include "unpifi.h"## 1 ##src/advio/dgechoaddr.c##
+
+#undef MAXLINE## 2 ##src/advio/dgechoaddr.c##
+#define MAXLINE 20 /* to see datagram truncation */## 3 ##src/advio/dgechoaddr.c##
+
+void## 4 ##src/advio/dgechoaddr.c##
+dg_echo(int sockfd, SA *pcliaddr, socklen_t clilen)## 5 ##src/advio/dgechoaddr.c##
+{## 6 ##src/advio/dgechoaddr.c##
+ int flags;## 7 ##src/advio/dgechoaddr.c##
+ const int on = 1;## 8 ##src/advio/dgechoaddr.c##
+ socklen_t len;## 9 ##src/advio/dgechoaddr.c##
+ ssize_t n;## 10 ##src/advio/dgechoaddr.c##
+ char mesg[MAXLINE], str[INET6_ADDRSTRLEN], ifname[IFNAMSIZ];## 11 ##src/advio/dgechoaddr.c##
+ struct in_addr in_zero;## 12 ##src/advio/dgechoaddr.c##
+ struct in_pktinfo pktinfo;## 13 ##src/advio/dgechoaddr.c##
+
+#ifdef IP_RECVDSTADDR## 14 ##src/advio/dgechoaddr.c##
+ if (setsockopt(sockfd, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on)) < 0)## 15 ##src/advio/dgechoaddr.c##
+ err_ret("setsockopt of IP_RECVDSTADDR");## 16 ##src/advio/dgechoaddr.c##
+#endif## 17 ##src/advio/dgechoaddr.c##
+#ifdef IP_RECVIF## 18 ##src/advio/dgechoaddr.c##
+ if (setsockopt(sockfd, IPPROTO_IP, IP_RECVIF, &on, sizeof(on)) < 0)## 19 ##src/advio/dgechoaddr.c##
+ err_ret("setsockopt of IP_RECVIF");## 20 ##src/advio/dgechoaddr.c##
+#endif## 21 ##src/advio/dgechoaddr.c##
+ bzero(&in_zero, sizeof(struct in_addr)); /* all 0 IPv4 address */## 22 ##src/advio/dgechoaddr.c##
+
+ for (;;) {## 23 ##src/advio/dgechoaddr.c##
+ len = clilen;## 24 ##src/advio/dgechoaddr.c##
+ flags = 0;## 25 ##src/advio/dgechoaddr.c##
+ n = Recvfrom_flags(sockfd, mesg, MAXLINE, &flags,## 26 ##src/advio/dgechoaddr.c##
+ pcliaddr, &len, &pktinfo);## 27 ##src/advio/dgechoaddr.c##
+ printf("%d-byte datagram from %s", n, Sock_ntop(pcliaddr, len));## 28 ##src/advio/dgechoaddr.c##
+ if (memcmp(&pktinfo.ipi_addr, &in_zero, sizeof(in_zero)) != 0)## 29 ##src/advio/dgechoaddr.c##
+ printf(", to %s", Inet_ntop(AF_INET, &pktinfo.ipi_addr,## 30 ##src/advio/dgechoaddr.c##
+ str, sizeof(str)));## 31 ##src/advio/dgechoaddr.c##
+ if (pktinfo.ipi_ifindex > 0)## 32 ##src/advio/dgechoaddr.c##
+ printf(", recv i/f = %s",## 33 ##src/advio/dgechoaddr.c##
+ If_indextoname(pktinfo.ipi_ifindex, ifname));## 34 ##src/advio/dgechoaddr.c##
+#ifdef MSG_TRUNC## 35 ##src/advio/dgechoaddr.c##
+ if (flags & MSG_TRUNC)## 36 ##src/advio/dgechoaddr.c##
+ printf(" (datagram truncated)");## 37 ##src/advio/dgechoaddr.c##
+#endif## 38 ##src/advio/dgechoaddr.c##
+#ifdef MSG_CTRUNC## 39 ##src/advio/dgechoaddr.c##
+ if (flags & MSG_CTRUNC)## 40 ##src/advio/dgechoaddr.c##
+ printf(" (control info truncated)");## 41 ##src/advio/dgechoaddr.c##
+#endif## 42 ##src/advio/dgechoaddr.c##
+#ifdef MSG_BCAST## 43 ##src/advio/dgechoaddr.c##
+ if (flags & MSG_BCAST)## 44 ##src/advio/dgechoaddr.c##
+ printf(" (broadcast)");## 45 ##src/advio/dgechoaddr.c##
+#endif## 46 ##src/advio/dgechoaddr.c##
+#ifdef MSG_MCAST## 47 ##src/advio/dgechoaddr.c##
+ if (flags & MSG_MCAST)## 48 ##src/advio/dgechoaddr.c##
+ printf(" (multicast)");## 49 ##src/advio/dgechoaddr.c##
+#endif## 50 ##src/advio/dgechoaddr.c##
+ printf("\n");## 51 ##src/advio/dgechoaddr.c##
+
+ Sendto(sockfd, mesg, n, 0, pcliaddr, len);## 52 ##src/advio/dgechoaddr.c##
+ }## 53 ##src/advio/dgechoaddr.c##
+}## 54 ##src/advio/dgechoaddr.c##
diff --git a/unix/unpv13e/advio/old/dgechoaddr.c b/unix/unpv13e/advio/old/dgechoaddr.c
new file mode 100644
index 0000000..e31c268
--- /dev/null
+++ b/unix/unpv13e/advio/old/dgechoaddr.c
@@ -0,0 +1,41 @@
+#include "unp.h"
+
+#undef MAXLINE
+#define MAXLINE 20 /* to see datagram truncation */
+
+void
+dg_echo(int sockfd, SA *pcliaddr, socklen_t clilen)
+{
+ int flags;
+ const int on = 1;
+ socklen_t len;
+ ssize_t n;
+ char mesg[MAXLINE], str[INET6_ADDRSTRLEN];
+ struct in_addr dstaddr;
+
+#ifdef IP_RECVDSTADDR
+ Setsockopt(sockfd, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on));
+#endif
+
+ for ( ; ; ) {
+ len = clilen;
+ flags = 0;
+ n = Recvfrom_flags(sockfd, mesg, MAXLINE, &flags,
+ pcliaddr, &len, &dstaddr);
+ printf("%d-byte datagram from %s", n, Sock_ntop(pcliaddr, len));
+ if ((flags & MSG_CTRUNC) == 0)
+ printf(", to %s", Inet_ntop(AF_INET, &dstaddr, str, sizeof(str)));
+#ifdef MSG_TRUNC
+ if (flags & MSG_TRUNC) printf(" (datagram truncated)");
+#endif
+#ifdef MSG_BCAST
+ if (flags & MSG_BCAST) printf(" (broadcast)");
+#endif
+#ifdef MSG_MCAST
+ if (flags & MSG_MCAST) printf(" (multicast)");
+#endif
+ printf("\n");
+
+ Sendto(sockfd, mesg, n, 0, pcliaddr, clilen);
+ }
+}
diff --git a/unix/unpv13e/advio/old/recvfromflags.c b/unix/unpv13e/advio/old/recvfromflags.c
new file mode 100644
index 0000000..bb74e0d
--- /dev/null
+++ b/unix/unpv13e/advio/old/recvfromflags.c
@@ -0,0 +1,77 @@
+#include "unp.h"
+
+ssize_t
+recvfrom_flags(int fd, void *ptr, size_t nbytes, int *flagsp,
+ SA *sa, socklen_t *salenptr, void *dstaddrp)
+{
+ struct msghdr msg;
+ struct iovec iov[1];
+ ssize_t n;
+
+#ifdef HAVE_MSGHDR_MSG_CONTROL
+#define CONTROL_LEN (sizeof(struct cmsghdr) + sizeof(struct in_addr))
+ char control[CONTROL_LEN];
+
+ msg.msg_control = control;
+ msg.msg_controllen = sizeof(control);
+ msg.msg_flags = 0;
+#else
+ bzero(&msg, sizeof(msg)); /* make certain msg_accrightslen = 0 */
+#endif
+
+ msg.msg_name = sa;
+ msg.msg_namelen = *salenptr;
+ iov[0].iov_base = ptr;
+ iov[0].iov_len = nbytes;
+ msg.msg_iov = iov;
+ msg.msg_iovlen = 1;
+
+ if ( (n = recvmsg(fd, &msg, *flagsp)) < 0)
+ return(n);
+
+ *salenptr = msg.msg_namelen; /* pass back results */
+#ifdef HAVE_MSGHDR_MSG_CONTROL
+ *flagsp = msg.msg_flags; /* pass back results */
+
+ /*
+ * We need someway to indicate to the caller that nothing was
+ * returned through dstaddrp (since all 32-bit values are valid
+ * IP destination addresses). To avoid having to add yet another
+ * pointer argument, we return MSG_CTRUNC (which unp.h always
+ * defines, even if the implementation does not).
+ */
+
+#ifdef IP_RECVDSTADDR
+ if (dstaddrp && msg.msg_controllen > 0 &&
+ (msg.msg_flags & MSG_CTRUNC) == 0) {
+ struct cmsghdr *cmptr = CMSG_FIRSTHDR(&msg);
+
+ if (cmptr->cmsg_len != CONTROL_LEN)
+ err_quit("control length = %d", cmptr->cmsg_len);
+ if (cmptr->cmsg_level != IPPROTO_IP)
+ err_quit("control level != IPPROTO_IP");
+ if (cmptr->cmsg_type != IP_RECVDSTADDR)
+ err_quit("control type != IP_RECVDSTADDR");
+ memcpy(dstaddrp, CMSG_DATA(cmptr), sizeof(struct in_addr));
+ } else
+#endif
+ *flagsp |= MSG_CTRUNC; /* dest IP addr not returned */
+#else
+ *flagsp |= MSG_CTRUNC; /* dest IP addr not returned */
+#endif /* HAVE_MSGHDR_MSG_CONTROL */
+
+ return(n);
+}
+
+ssize_t
+Recvfrom_flags(int fd, void *ptr, size_t nbytes, int *flagsp,
+ SA *sa, socklen_t *salenptr, void *dstaddrp)
+{
+ ssize_t n;
+
+ n = recvfrom_flags(fd, ptr, nbytes, flagsp, sa, salenptr, dstaddrp);
+ if (n < 0)
+ err_quit("recvfrom_flags error");
+
+ return(n);
+}
diff --git a/unix/unpv13e/advio/old/test01.c b/unix/unpv13e/advio/old/test01.c
new file mode 100644
index 0000000..b09c318
--- /dev/null
+++ b/unix/unpv13e/advio/old/test01.c
@@ -0,0 +1,72 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd, flag;
+ ssize_t n;
+ char buff[MAXLINE];
+ const int on = 1;
+ socklen_t addrlen, len;
+ struct sockaddr *cliaddr;
+
+ if (argc == 2)
+ sockfd = Udp_server(NULL, argv[1], &addrlen);
+ else if (argc == 3)
+ sockfd = Udp_server(argv[1], argv[2], &addrlen);
+ else
+ err_quit("usage: test01 ");
+
+ cliaddr = Malloc(addrlen);
+
+#ifdef IP_RECVDSTADDR
+ Setsockopt(sockfd, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on));
+
+ len = sizeof(flag);
+ Getsockopt(sockfd, IPPROTO_IP, IP_RECVDSTADDR, &flag, &len);
+ printf("IP_RECVDSTADDR option = %d, size = %d\n", flag, len);
+#else
+ printf("IP_RECVDSTADDR not defined\n");
+#endif
+
+#ifdef IP_RECVIF
+ Setsockopt(sockfd, IPPROTO_IP, IP_RECVIF, &on, sizeof(on));
+
+ len = sizeof(flag);
+ Getsockopt(sockfd, IPPROTO_IP, IP_RECVIF, &flag, &len);
+ printf("IP_RECVIF option = %d, size = %d\n", flag, len);
+#else
+ printf("IP_RECVIF not defined\n");
+#endif
+
+ for ( ; ; ) {
+#define CONTROL_LEN (sizeof(struct cmsghdr) + sizeof(struct in_addr))
+ char control[CONTROL_LEN];
+
+ msg.msg_control = control;
+ msg.msg_controllen = sizeof(control);
+ msg.msg_flags = 0;
+#else
+ bzero(&msg, sizeof(msg)); /* make certain msg_accrightslen = 0 */
+#endif
+
+ msg.msg_name = sa;
+ msg.msg_namelen = *salenptr;
+ iov[0].iov_base = ptr;
+ iov[0].iov_len = nbytes;
+ msg.msg_iov = iov;
+ msg.msg_iovlen = 1;
+
+ if ( (n = recvmsg(fd, &msg, *flagsp)) < 0)
+ return(n);
+
+ len = addrlen;
+ n = Recvfrom(sockfd, buff, MAXLINE, 0, cliaddr, &len);
+ printf("datagram from %s\n", Sock_ntop(cliaddr, len));
+
+ ticks = time(NULL);
+ snprintf(buff, sizeof(buff), "%.24s\r\n", ctime(&ticks));
+ Sendto(sockfd, buff, strlen(buff), 0, cliaddr, len);
+ }
+ exit(0);
+}
diff --git a/unix/unpv13e/advio/recvfromflags.c b/unix/unpv13e/advio/recvfromflags.c
new file mode 100644
index 0000000..a3a316c
--- /dev/null
+++ b/unix/unpv13e/advio/recvfromflags.c
@@ -0,0 +1,96 @@
+/* include recvfrom_flags1 */
+#include "unp.h"
+#include /* ALIGN macro for CMSG_NXTHDR() macro */
+
+ssize_t
+recvfrom_flags(int fd, void *ptr, size_t nbytes, int *flagsp,
+ SA *sa, socklen_t *salenptr, struct unp_in_pktinfo *pktp)
+{
+ struct msghdr msg;
+ struct iovec iov[1];
+ ssize_t n;
+
+#ifdef HAVE_MSGHDR_MSG_CONTROL
+ struct cmsghdr *cmptr;
+ union {
+ struct cmsghdr cm;
+ char control[CMSG_SPACE(sizeof(struct in_addr)) +
+ CMSG_SPACE(sizeof(struct unp_in_pktinfo))];
+ } control_un;
+
+ msg.msg_control = control_un.control;
+ msg.msg_controllen = sizeof(control_un.control);
+ msg.msg_flags = 0;
+#else
+ bzero(&msg, sizeof(msg)); /* make certain msg_accrightslen = 0 */
+#endif
+
+ msg.msg_name = sa;
+ msg.msg_namelen = *salenptr;
+ iov[0].iov_base = ptr;
+ iov[0].iov_len = nbytes;
+ msg.msg_iov = iov;
+ msg.msg_iovlen = 1;
+
+ if ( (n = recvmsg(fd, &msg, *flagsp)) < 0)
+ return(n);
+
+ *salenptr = msg.msg_namelen; /* pass back results */
+ if (pktp)
+ bzero(pktp, sizeof(struct unp_in_pktinfo)); /* 0.0.0.0, i/f = 0 */
+/* end recvfrom_flags1 */
+
+/* include recvfrom_flags2 */
+#ifndef HAVE_MSGHDR_MSG_CONTROL
+ *flagsp = 0; /* pass back results */
+ return(n);
+#else
+
+ *flagsp = msg.msg_flags; /* pass back results */
+ if (msg.msg_controllen < sizeof(struct cmsghdr) ||
+ (msg.msg_flags & MSG_CTRUNC) || pktp == NULL)
+ return(n);
+
+ for (cmptr = CMSG_FIRSTHDR(&msg); cmptr != NULL;
+ cmptr = CMSG_NXTHDR(&msg, cmptr)) {
+
+#ifdef IP_RECVDSTADDR
+ if (cmptr->cmsg_level == IPPROTO_IP &&
+ cmptr->cmsg_type == IP_RECVDSTADDR) {
+
+ memcpy(&pktp->ipi_addr, CMSG_DATA(cmptr),
+ sizeof(struct in_addr));
+ continue;
+ }
+#endif
+
+#ifdef IP_RECVIF
+ if (cmptr->cmsg_level == IPPROTO_IP &&
+ cmptr->cmsg_type == IP_RECVIF) {
+ struct sockaddr_dl *sdl;
+
+ sdl = (struct sockaddr_dl *) CMSG_DATA(cmptr);
+ pktp->ipi_ifindex = sdl->sdl_index;
+ continue;
+ }
+#endif
+ err_quit("unknown ancillary data, len = %d, level = %d, type = %d",
+ cmptr->cmsg_len, cmptr->cmsg_level, cmptr->cmsg_type);
+ }
+ return(n);
+#endif /* HAVE_MSGHDR_MSG_CONTROL */
+}
+/* end recvfrom_flags2 */
+
+ssize_t
+Recvfrom_flags(int fd, void *ptr, size_t nbytes, int *flagsp,
+ SA *sa, socklen_t *salenptr, struct unp_in_pktinfo *pktp)
+{
+ ssize_t n;
+
+ n = recvfrom_flags(fd, ptr, nbytes, flagsp, sa, salenptr, pktp);
+ if (n < 0)
+ err_quit("recvfrom_flags error");
+
+ return(n);
+}
diff --git a/unix/unpv13e/advio/recvfromflags.lc b/unix/unpv13e/advio/recvfromflags.lc
new file mode 100644
index 0000000..439702e
--- /dev/null
+++ b/unix/unpv13e/advio/recvfromflags.lc
@@ -0,0 +1,99 @@
+/* include recvfrom_flags1 */
+#include "unp.h"## 1 ##src/advio/recvfromflags.c##
+#include /* ALIGN macro for CMSG_NXTHDR() macro */## 2 ##src/advio/recvfromflags.c##
+
+#ifdef HAVE_SOCKADDR_DL_STRUCT## 3 ##src/advio/recvfromflags.c##
+# include ## 4 ##src/advio/recvfromflags.c##
+#endif## 5 ##src/advio/recvfromflags.c##
+
+ssize_t## 6 ##src/advio/recvfromflags.c##
+recvfrom_flags(int fd, void *ptr, size_t nbytes, int *flagsp,## 7 ##src/advio/recvfromflags.c##
+ SA *sa, socklen_t *salenptr, struct in_pktinfo *pktp)## 8 ##src/advio/recvfromflags.c##
+{## 9 ##src/advio/recvfromflags.c##
+ struct msghdr msg;## 10 ##src/advio/recvfromflags.c##
+ struct iovec iov[1];## 11 ##src/advio/recvfromflags.c##
+ ssize_t n;## 12 ##src/advio/recvfromflags.c##
+
+#ifdef HAVE_MSGHDR_MSG_CONTROL## 13 ##src/advio/recvfromflags.c##
+ struct cmsghdr *cmptr;## 14 ##src/advio/recvfromflags.c##
+ union {## 15 ##src/advio/recvfromflags.c##
+ struct cmsghdr cm;## 16 ##src/advio/recvfromflags.c##
+ char control[CMSG_SPACE(sizeof(struct in_addr)) +## 17 ##src/advio/recvfromflags.c##
+ CMSG_SPACE(sizeof(struct in_pktinfo))];## 18 ##src/advio/recvfromflags.c##
+ } control_un;## 19 ##src/advio/recvfromflags.c##
+
+ msg.msg_control = control_un.control;## 20 ##src/advio/recvfromflags.c##
+ msg.msg_controllen = sizeof(control_un.control);## 21 ##src/advio/recvfromflags.c##
+ msg.msg_flags = 0;## 22 ##src/advio/recvfromflags.c##
+#else## 23 ##src/advio/recvfromflags.c##
+ bzero(&msg, sizeof(msg)); /* make certain msg_accrightslen = 0 */## 24 ##src/advio/recvfromflags.c##
+#endif## 25 ##src/advio/recvfromflags.c##
+
+ msg.msg_name = sa;## 26 ##src/advio/recvfromflags.c##
+ msg.msg_namelen = *salenptr;## 27 ##src/advio/recvfromflags.c##
+ iov[0].iov_base = ptr;## 28 ##src/advio/recvfromflags.c##
+ iov[0].iov_len = nbytes;## 29 ##src/advio/recvfromflags.c##
+ msg.msg_iov = iov;## 30 ##src/advio/recvfromflags.c##
+ msg.msg_iovlen = 1;## 31 ##src/advio/recvfromflags.c##
+
+ if ((n = recvmsg(fd, &msg, *flagsp)) < 0)## 32 ##src/advio/recvfromflags.c##
+ return (n);## 33 ##src/advio/recvfromflags.c##
+
+ *salenptr = msg.msg_namelen; /* pass back results */## 34 ##src/advio/recvfromflags.c##
+ if (pktp)## 35 ##src/advio/recvfromflags.c##
+ bzero(pktp, sizeof(struct in_pktinfo)); /* 0.0.0.0, i/f = 0 */## 36 ##src/advio/recvfromflags.c##
+/* end recvfrom_flags1 */
+
+/* include recvfrom_flags2 */
+#ifndef HAVE_MSGHDR_MSG_CONTROL## 37 ##src/advio/recvfromflags.c##
+ *flagsp = 0; /* pass back results */## 38 ##src/advio/recvfromflags.c##
+ return (n);## 39 ##src/advio/recvfromflags.c##
+#else## 40 ##src/advio/recvfromflags.c##
+
+ *flagsp = msg.msg_flags; /* pass back results */## 41 ##src/advio/recvfromflags.c##
+ if (msg.msg_controllen < sizeof(struct cmsghdr) ||## 42 ##src/advio/recvfromflags.c##
+ (msg.msg_flags & MSG_CTRUNC) || pktp == NULL)## 43 ##src/advio/recvfromflags.c##
+ return (n);## 44 ##src/advio/recvfromflags.c##
+
+ for (cmptr = CMSG_FIRSTHDR(&msg); cmptr != NULL;## 45 ##src/advio/recvfromflags.c##
+ cmptr = CMSG_NXTHDR(&msg, cmptr)) {## 46 ##src/advio/recvfromflags.c##
+
+#ifdef IP_RECVDSTADDR## 47 ##src/advio/recvfromflags.c##
+ if (cmptr->cmsg_level == IPPROTO_IP &# 48 ##src/advio/recvfromflags.c##
+ cmptr->cmsg_type == IP_RECVDSTADDR) {## 49 ##src/advio/recvfromflags.c##
+
+ memcpy(&pktp->ipi_addr, CMSG_DATA(cmptr),## 50 ##src/advio/recvfromflags.c##
+ sizeof(struct in_addr));## 51 ##src/advio/recvfromflags.c##
+ continue;## 52 ##src/advio/recvfromflags.c##
+ }## 53 ##src/advio/recvfromflags.c##
+#endif## 54 ##src/advio/recvfromflags.c##
+
+#ifdef IP_RECVIF## 55 ##src/advio/recvfromflags.c##
+ if (cmptr->cmsg_level == IPPROTO_IP && cmptr->cmsg_type == IP_RECVIF) {## 56 ##src/advio/recvfromflags.c##
+ struct sockaddr_dl *sdl;## 57 ##src/advio/recvfromflags.c##
+
+ sdl = (struct sockaddr_dl *) CMSG_DATA(cmptr);## 58 ##src/advio/recvfromflags.c##
+ pktp->ipi_ifindex = sdl->sdl_index;## 59 ##src/advio/recvfromflags.c##
+ continue;## 60 ##src/advio/recvfromflags.c##
+ }## 61 ##src/advio/recvfromflags.c##
+#endif## 62 ##src/advio/recvfromflags.c##
+ err_quit("unknown ancillary data, len = %d, level = %d, type = %d",## 63 ##src/advio/recvfromflags.c##
+ cmptr->cmsg_len, cmptr->cmsg_level, cmptr->cmsg_type);## 64 ##src/advio/recvfromflags.c##
+ }## 65 ##src/advio/recvfromflags.c##
+ return (n);## 66 ##src/advio/recvfromflags.c##
+#endif /* HAVE_MSGHDR_MSG_CONTROL */## 67 ##src/advio/recvfromflags.c##
+}## 68 ##src/advio/recvfromflags.c##
+/* end recvfrom_flags2 */
+
+ssize_t## 69 ##src/advio/recvfromflags.c##
+Recvfrom_flags(int fd, void *ptr, size_t nbytes, int *flagsp,## 70 ##src/advio/recvfromflags.c##
+ SA *sa, socklen_t *salenptr, struct in_pktinfo *pktp)## 71 ##src/advio/recvfromflags.c##
+{## 72 ##src/advio/recvfromflags.c##
+ ssize_t n;## 73 ##src/advio/recvfromflags.c##
+
+ n = recvfrom_flags(fd, ptr, nbytes, flagsp, sa, salenptr, pktp);## 74 ##src/advio/recvfromflags.c##
+ if (n < 0)## 75 ##src/advio/recvfromflags.c##
+ err_quit("recvfrom_flags error");## 76 ##src/advio/recvfromflags.c##
+
+ return (n);## 77 ##src/advio/recvfromflags.c##
+}## 78 ##src/advio/recvfromflags.c##
diff --git a/unix/unpv13e/advio/script.1 b/unix/unpv13e/advio/script.1
new file mode 100644
index 0000000..7df1561
--- /dev/null
+++ b/unix/unpv13e/advio/script.1
@@ -0,0 +1,6 @@
+kalae % ./udpserv01
+9-byte datagram from 206.62.226.33.41164, to 206.62.226.35, recv i/f = ef0
+13-byte datagram from 206.62.226.65.1057, to 206.62.226.95, recv i/f = we0 (broadcast)
+4-byte datagram from 206.62.226.33.41176, to 224.0.0.1, recv i/f = ef0 (multicast)
+20-byte datagram from 127.0.0.1.4632, to 127.0.0.1, recv i/f = lo0 (datagram truncated)
+9-byte datagram from 206.62.226.33.41178, to 206.62.226.66, recv i/f = ef0
diff --git a/unix/unpv13e/advio/sig_chld_waitpid.c b/unix/unpv13e/advio/sig_chld_waitpid.c
new file mode 100644
index 0000000..5fa9cbf
--- /dev/null
+++ b/unix/unpv13e/advio/sig_chld_waitpid.c
@@ -0,0 +1,13 @@
+#include "unp.h"
+
+void
+sig_chld(int signo)
+{
+ pid_t pid;
+ int stat;
+
+ while ( (pid = waitpid(-1, &stat, WNOHANG)) > 0) {
+ printf("child %d terminated\n", pid);
+ }
+ return;
+}
diff --git a/unix/unpv13e/advio/str_cli_kqueue04.c b/unix/unpv13e/advio/str_cli_kqueue04.c
new file mode 100644
index 0000000..00550a7
--- /dev/null
+++ b/unix/unpv13e/advio/str_cli_kqueue04.c
@@ -0,0 +1,52 @@
+#include "unp.h"
+
+void
+str_cli(FILE *fp, int sockfd)
+{
+ int kq, i, n, nev, stdineof = 0, isfile;
+ char buf[MAXLINE];
+ struct kevent kev[2];
+ struct timespec ts;
+ struct stat st;
+
+ isfile = ((fstat(fileno(fp), &st) == 0) &&
+ (st.st_mode & S_IFMT) == S_IFREG);
+
+ EV_SET(&kev[0], fileno(fp), EVFILT_READ, EV_ADD, 0, 0, NULL);
+ EV_SET(&kev[1], sockfd, EVFILT_READ, EV_ADD, 0, 0, NULL);
+
+ kq = Kqueue();
+ ts.tv_sec = ts.tv_nsec = 0;
+ Kevent(kq, kev, 2, NULL, 0, &ts);
+
+ for ( ; ; ) {
+ nev = Kevent(kq, NULL, 0, kev, 2, NULL);
+
+ for (i = 0; i < nev; i++) {
+ if (kev[i].ident == sockfd) { /* socket is readable */
+ if ( (n = Read(sockfd, buf, MAXLINE)) == 0) {
+ if (stdineof == 1)
+ return; /* normal termination */
+ else
+ err_quit("str_cli: server terminated prematurely");
+ }
+
+ Write(fileno(stdout), buf, n);
+ }
+
+ if (kev[i].ident == fileno(fp)) { /* input is readable */
+ n = Read(fileno(fp), buf, MAXLINE);
+ if (n > 0)
+ Writen(sockfd, buf, n);
+
+ if (n == 0 || (isfile && n == kev[i].data)) {
+ stdineof = 1;
+ Shutdown(sockfd, SHUT_WR); /* send FIN */
+ kev[i].flags = EV_DELETE;
+ Kevent(kq, &kev[i], 1, NULL, 0, &ts); /* remove kevent */
+ continue;
+ }
+ }
+ }
+ }
+}
diff --git a/unix/unpv13e/advio/str_cli_poll03.c b/unix/unpv13e/advio/str_cli_poll03.c
new file mode 100644
index 0000000..c4748b8
--- /dev/null
+++ b/unix/unpv13e/advio/str_cli_poll03.c
@@ -0,0 +1,60 @@
+#include "unp.h"
+#include
+
+void
+str_cli(FILE *fp, int sockfd)
+{
+ int stdineof;
+ char buf[MAXLINE];
+ int n;
+ int wfd;
+ struct pollfd pollfd[2];
+ struct dvpoll dopoll;
+ int i;
+ int result;
+
+ wfd = Open("/dev/poll", O_RDWR, 0);
+
+ pollfd[0].fd = fileno(fp);
+ pollfd[0].events = POLLIN;
+ pollfd[0].revents = 0;
+
+ pollfd[1].fd = sockfd;
+ pollfd[1].events = POLLIN;
+ pollfd[1].revents = 0;
+
+ Write(wfd, pollfd, sizeof(struct pollfd) * 2);
+
+ stdineof = 0;
+ for ( ; ; ) {
+ /* block until /dev/poll says something is ready */
+ dopoll.dp_timeout = -1;
+ dopoll.dp_nfds = 2;
+ dopoll.dp_fds = pollfd;
+ result = Ioctl(wfd, DP_POLL, &dopoll);
+
+ /* loop through ready file descriptors */
+ for (i = 0; i < result; i++) {
+ if (dopoll.dp_fds[i].fd == sockfd) {
+ /* socket is readable */
+ if ( (n = Read(sockfd, buf, MAXLINE)) == 0) {
+ if (stdineof == 1)
+ return; /* normal termination */
+ else
+ err_quit("str_cli: server terminated prematurely");
+ }
+
+ Write(fileno(stdout), buf, n);
+ } else {
+ /* input is readable */
+ if ( (n = Read(fileno(fp), buf, MAXLINE)) == 0) {
+ stdineof = 1;
+ Shutdown(sockfd, SHUT_WR); /* send FIN */
+ continue;
+ }
+
+ Writen(sockfd, buf, n);
+ }
+ }
+ }
+}
diff --git a/unix/unpv13e/advio/str_cli_select02.c b/unix/unpv13e/advio/str_cli_select02.c
new file mode 100644
index 0000000..9a01462
--- /dev/null
+++ b/unix/unpv13e/advio/str_cli_select02.c
@@ -0,0 +1,40 @@
+#include "unp.h"
+
+void
+str_cli(FILE *fp, int sockfd)
+{
+ int maxfdp1, stdineof = 0;
+ fd_set rset;
+ char sendline[MAXLINE], recvline[MAXLINE];
+
+ FD_ZERO(&rset);
+ for ( ; ; ) {
+ if (stdineof == 0)
+ FD_SET(fileno(fp), &rset);
+ FD_SET(sockfd, &rset);
+ maxfdp1 = max(fileno(fp), sockfd) + 1;
+ Select(maxfdp1, &rset, NULL, NULL, NULL);
+
+ if (FD_ISSET(sockfd, &rset)) { /* socket is readable */
+ if (Readline(sockfd, recvline, MAXLINE) == 0) {
+ if (stdineof == 1)
+ return; /* normal termination */
+ else
+ err_quit("str_cli: server terminated prematurely");
+ }
+
+ Fputs(recvline, stdout);
+ }
+
+ if (FD_ISSET(fileno(fp), &rset)) { /* input is readable */
+ if (Fgets(sendline, MAXLINE, fp) == NULL) {
+ stdineof = 1;
+ Shutdown(sockfd, SHUT_WR); /* send FIN */
+ FD_CLR(fileno(fp), &rset);
+ continue;
+ }
+
+ Writen(sockfd, sendline, strlen(sendline));
+ }
+ }
+}
diff --git a/unix/unpv13e/advio/str_echo_stdio02.c b/unix/unpv13e/advio/str_echo_stdio02.c
new file mode 100644
index 0000000..538137f
--- /dev/null
+++ b/unix/unpv13e/advio/str_echo_stdio02.c
@@ -0,0 +1,14 @@
+#include "unp.h"
+
+void
+str_echo(int sockfd)
+{
+ char line[MAXLINE];
+ FILE *fpin, *fpout;
+
+ fpin = Fdopen(sockfd, "r");
+ fpout = Fdopen(sockfd, "w");
+
+ while (Fgets(line, MAXLINE, fpin) != NULL)
+ Fputs(line, fpout);
+}
diff --git a/unix/unpv13e/advio/str_echo_stdio02.lc b/unix/unpv13e/advio/str_echo_stdio02.lc
new file mode 100644
index 0000000..32e4819
--- /dev/null
+++ b/unix/unpv13e/advio/str_echo_stdio02.lc
@@ -0,0 +1,14 @@
+#include "unp.h"## 1 ##src/advio/str_echo_stdio02.c##
+
+void## 2 ##src/advio/str_echo_stdio02.c##
+str_echo(int sockfd)## 3 ##src/advio/str_echo_stdio02.c##
+{## 4 ##src/advio/str_echo_stdio02.c##
+ char line[MAXLINE];## 5 ##src/advio/str_echo_stdio02.c##
+ FILE *fpin, *fpout;## 6 ##src/advio/str_echo_stdio02.c##
+
+ fpin = Fdopen(sockfd, "r");## 7 ##src/advio/str_echo_stdio02.c##
+ fpout = Fdopen(sockfd, "w");## 8 ##src/advio/str_echo_stdio02.c##
+
+ while (Fgets(line, MAXLINE, fpin) != NULL)## 9 ##src/advio/str_echo_stdio02.c##
+ Fputs(line, fpout);## 10 ##src/advio/str_echo_stdio02.c##
+}## 11 ##src/advio/str_echo_stdio02.c##
diff --git a/unix/unpv13e/advio/tcpcli01.c b/unix/unpv13e/advio/tcpcli01.c
new file mode 100644
index 0000000..66ce515
--- /dev/null
+++ b/unix/unpv13e/advio/tcpcli01.c
@@ -0,0 +1,25 @@
+/* Use standard echo server; baseline measurements for nonblocking version */
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd;
+ struct sockaddr_in servaddr;
+
+ if (argc != 2)
+ err_quit("usage: tcpcli ");
+
+ sockfd = Socket(AF_INET, SOCK_STREAM, 0);
+
+ bzero(&servaddr, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_port = htons(7);
+ Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
+
+ Connect_timeo(sockfd, (SA *) &servaddr, sizeof(servaddr), 10);
+
+ str_cli(stdin, sockfd); /* do it all */
+
+ exit(0);
+}
diff --git a/unix/unpv13e/advio/tcpcli02.c b/unix/unpv13e/advio/tcpcli02.c
new file mode 100644
index 0000000..af1f1bf
--- /dev/null
+++ b/unix/unpv13e/advio/tcpcli02.c
@@ -0,0 +1,24 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd;
+ struct sockaddr_in servaddr;
+
+ if (argc != 2)
+ err_quit("usage: tcpcli ");
+
+ sockfd = Socket(AF_INET, SOCK_STREAM, 0);
+
+ bzero(&servaddr, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_port = htons(SERV_PORT);
+ Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
+
+ Connect(sockfd, (SA *) &servaddr, sizeof(servaddr));
+
+ str_cli(stdin, sockfd); /* do it all */
+
+ exit(0);
+}
diff --git a/unix/unpv13e/advio/tcpcli03.c b/unix/unpv13e/advio/tcpcli03.c
new file mode 100644
index 0000000..af1f1bf
--- /dev/null
+++ b/unix/unpv13e/advio/tcpcli03.c
@@ -0,0 +1,24 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd;
+ struct sockaddr_in servaddr;
+
+ if (argc != 2)
+ err_quit("usage: tcpcli ");
+
+ sockfd = Socket(AF_INET, SOCK_STREAM, 0);
+
+ bzero(&servaddr, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_port = htons(SERV_PORT);
+ Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
+
+ Connect(sockfd, (SA *) &servaddr, sizeof(servaddr));
+
+ str_cli(stdin, sockfd); /* do it all */
+
+ exit(0);
+}
diff --git a/unix/unpv13e/advio/tcpcli04.c b/unix/unpv13e/advio/tcpcli04.c
new file mode 100644
index 0000000..af1f1bf
--- /dev/null
+++ b/unix/unpv13e/advio/tcpcli04.c
@@ -0,0 +1,24 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd;
+ struct sockaddr_in servaddr;
+
+ if (argc != 2)
+ err_quit("usage: tcpcli ");
+
+ sockfd = Socket(AF_INET, SOCK_STREAM, 0);
+
+ bzero(&servaddr, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_port = htons(SERV_PORT);
+ Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
+
+ Connect(sockfd, (SA *) &servaddr, sizeof(servaddr));
+
+ str_cli(stdin, sockfd); /* do it all */
+
+ exit(0);
+}
diff --git a/unix/unpv13e/advio/tcpserv02.c b/unix/unpv13e/advio/tcpserv02.c
new file mode 100644
index 0000000..a964276
--- /dev/null
+++ b/unix/unpv13e/advio/tcpserv02.c
@@ -0,0 +1,41 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int listenfd, connfd;
+ pid_t childpid;
+ socklen_t clilen;
+ struct sockaddr_in cliaddr, servaddr;
+ void sig_chld(int);
+
+ listenfd = Socket(AF_INET, SOCK_STREAM, 0);
+
+ bzero(&servaddr, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
+ servaddr.sin_port = htons(SERV_PORT);
+
+ Bind(listenfd, (SA *) &servaddr, sizeof(servaddr));
+
+ Listen(listenfd, LISTENQ);
+
+ Signal(SIGCHLD, sig_chld);
+
+ for ( ; ; ) {
+ clilen = sizeof(cliaddr);
+ if ( (connfd = accept(listenfd, (SA *) &cliaddr, &clilen)) < 0) {
+ if (errno == EINTR)
+ continue; /* back to for() */
+ else
+ err_sys("accept error");
+ }
+
+ if ( (childpid = Fork()) == 0) { /* child process */
+ Close(listenfd); /* close listening socket */
+ str_echo(connfd); /* process the request */
+ exit(0);
+ }
+ Close(connfd); /* parent closes connected socket */
+ }
+}
diff --git a/unix/unpv13e/advio/udpcli01.c b/unix/unpv13e/advio/udpcli01.c
new file mode 100644
index 0000000..01beb88
--- /dev/null
+++ b/unix/unpv13e/advio/udpcli01.c
@@ -0,0 +1,22 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd;
+ struct sockaddr_in servaddr;
+
+ if (argc != 2)
+ err_quit("usage: udpcli ");
+
+ bzero(&servaddr, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_port = htons(7);
+ Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
+
+ sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
+
+ dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
+
+ exit(0);
+}
diff --git a/unix/unpv13e/advio/udpcli02.c b/unix/unpv13e/advio/udpcli02.c
new file mode 100644
index 0000000..01beb88
--- /dev/null
+++ b/unix/unpv13e/advio/udpcli02.c
@@ -0,0 +1,22 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd;
+ struct sockaddr_in servaddr;
+
+ if (argc != 2)
+ err_quit("usage: udpcli ");
+
+ bzero(&servaddr, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_port = htons(7);
+ Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
+
+ sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
+
+ dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
+
+ exit(0);
+}
diff --git a/unix/unpv13e/advio/udpcli03.c b/unix/unpv13e/advio/udpcli03.c
new file mode 100644
index 0000000..01beb88
--- /dev/null
+++ b/unix/unpv13e/advio/udpcli03.c
@@ -0,0 +1,22 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd;
+ struct sockaddr_in servaddr;
+
+ if (argc != 2)
+ err_quit("usage: udpcli ");
+
+ bzero(&servaddr, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_port = htons(7);
+ Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
+
+ sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
+
+ dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
+
+ exit(0);
+}
diff --git a/unix/unpv13e/advio/udpserv01.c b/unix/unpv13e/advio/udpserv01.c
new file mode 100644
index 0000000..a21a857
--- /dev/null
+++ b/unix/unpv13e/advio/udpserv01.c
@@ -0,0 +1,19 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd;
+ struct sockaddr_in servaddr, cliaddr;
+
+ sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
+
+ bzero(&servaddr, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
+ servaddr.sin_port = htons(SERV_PORT);
+
+ Bind(sockfd, (SA *) &servaddr, sizeof(servaddr));
+
+ dg_echo(sockfd, (SA *) &cliaddr, sizeof(cliaddr));
+}
diff --git a/unix/unpv13e/advio/udpserv03.c b/unix/unpv13e/advio/udpserv03.c
new file mode 100644
index 0000000..02e5b60
--- /dev/null
+++ b/unix/unpv13e/advio/udpserv03.c
@@ -0,0 +1,101 @@
+/* include udpserv1 */
+#include "unpifi.h"
+
+void mydg_echo(int, SA *, socklen_t, SA *);
+
+int
+main(int argc, char **argv)
+{
+ int sockfd;
+ const int on = 1;
+ pid_t pid;
+ struct ifi_info *ifi, *ifihead;
+ struct sockaddr_in *sa, cliaddr, wildaddr;
+
+ for (ifihead = ifi = Get_ifi_info(AF_INET, 1);
+ ifi != NULL; ifi = ifi->ifi_next) {
+
+ /*4bind unicast address */
+ sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
+
+ Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+
+ sa = (struct sockaddr_in *) ifi->ifi_addr;
+ sa->sin_family = AF_INET;
+ sa->sin_port = htons(SERV_PORT);
+ Bind(sockfd, (SA *) sa, sizeof(*sa));
+ printf("bound %s\n", Sock_ntop((SA *) sa, sizeof(*sa)));
+
+ if ( (pid = Fork()) == 0) { /* child */
+ mydg_echo(sockfd, (SA *) &cliaddr, sizeof(cliaddr), (SA *) sa);
+ exit(0); /* never executed */
+ }
+/* end udpserv1 */
+/* include udpserv2 */
+ if (ifi->ifi_flags & IFF_BROADCAST) {
+ /* 4try to bind broadcast address */
+ sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
+ Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+
+ sa = (struct sockaddr_in *) ifi->ifi_brdaddr;
+ sa->sin_family = AF_INET;
+ sa->sin_port = htons(SERV_PORT);
+ if (bind(sockfd, (SA *) sa, sizeof(*sa)) < 0) {
+ if (errno == EADDRINUSE) {
+ printf("EADDRINUSE: %s\n",
+ Sock_ntop((SA *) sa, sizeof(*sa)));
+ Close(sockfd);
+ continue;
+ } else
+ err_sys("bind error for %s",
+ Sock_ntop((SA *) sa, sizeof(*sa)));
+ }
+ printf("bound %s\n", Sock_ntop((SA *) sa, sizeof(*sa)));
+
+ if ( (pid = Fork()) == 0) { /* child */
+ mydg_echo(sockfd, (SA *) &cliaddr, sizeof(cliaddr),
+ (SA *) sa);
+ exit(0); /* never executed */
+ }
+ }
+ }
+/* end udpserv2 */
+/* include udpserv3 */
+ /* 4bind wildcard address */
+ sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
+ Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+
+ bzero(&wildaddr, sizeof(wildaddr));
+ wildaddr.sin_family = AF_INET;
+ wildaddr.sin_addr.s_addr = htonl(INADDR_ANY);
+ wildaddr.sin_port = htons(SERV_PORT);
+ Bind(sockfd, (SA *) &wildaddr, sizeof(wildaddr));
+ printf("bound %s\n", Sock_ntop((SA *) &wildaddr, sizeof(wildaddr)));
+
+ if ( (pid = Fork()) == 0) { /* child */
+ mydg_echo(sockfd, (SA *) &cliaddr, sizeof(cliaddr), (SA *) sa);
+ exit(0); /* never executed */
+ }
+ exit(0);
+}
+/* end udpserv3 */
+
+/* include mydg_echo */
+void
+mydg_echo(int sockfd, SA *pcliaddr, socklen_t clilen, SA *myaddr)
+{
+ int n;
+ char mesg[MAXLINE];
+ socklen_t len;
+
+ for ( ; ; ) {
+ len = clilen;
+ n = Recvfrom(sockfd, mesg, MAXLINE, 0, pcliaddr, &len);
+ printf("child %d, datagram from %s", getpid(),
+ Sock_ntop(pcliaddr, len));
+ printf(", to %s\n", Sock_ntop(myaddr, clilen));
+
+ Sendto(sockfd, mesg, n, 0, pcliaddr, len);
+ }
+}
+/* end mydg_echo */
diff --git a/unix/unpv13e/advio/udpserv03.lc b/unix/unpv13e/advio/udpserv03.lc
new file mode 100644
index 0000000..f342f38
--- /dev/null
+++ b/unix/unpv13e/advio/udpserv03.lc
@@ -0,0 +1,101 @@
+/* include udpserv1 */
+#include "unpifi.h"## 1 ##src/advio/udpserv03.c##
+
+void mydg_echo(int, SA *, socklen_t, SA *);## 2 ##src/advio/udpserv03.c##
+
+int## 3 ##src/advio/udpserv03.c##
+main(int argc, char **argv)## 4 ##src/advio/udpserv03.c##
+{## 5 ##src/advio/udpserv03.c##
+ int sockfd;## 6 ##src/advio/udpserv03.c##
+ const int on = 1;## 7 ##src/advio/udpserv03.c##
+ pid_t pid;## 8 ##src/advio/udpserv03.c##
+ struct ifi_info *ifi, *ifihead;## 9 ##src/advio/udpserv03.c##
+ struct sockaddr_in *sa, cliaddr, wildaddr;## 10 ##src/advio/udpserv03.c##
+
+ for (ifihead = ifi = Get_ifi_info(AF_INET, 1);## 11 ##src/advio/udpserv03.c##
+ ifi != NULL; ifi = ifi->ifi_next) {## 12 ##src/advio/udpserv03.c##
+
+ /* 4bind unicast address */## 13 ##src/advio/udpserv03.c##
+ sockfd = Socket(AF_INET, SOCK_DGRAM, 0);## 14 ##src/advio/udpserv03.c##
+
+ Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));## 15 ##src/advio/udpserv03.c##
+
+ sa = (struct sockaddr_in *) ifi->ifi_addr;## 16 ##src/advio/udpserv03.c##
+ sa->sin_family = AF_INET;## 17 ##src/advio/udpserv03.c##
+ sa->sin_port = htons(SERV_PORT);## 18 ##src/advio/udpserv03.c##
+ Bind(sockfd, (SA *) sa, sizeof(*sa));## 19 ##src/advio/udpserv03.c##
+ printf("bound %s\n", Sock_ntop((SA *) sa, sizeof(*sa)));## 20 ##src/advio/udpserv03.c##
+
+ if ((pid = Fork()) == 0) { /* child */## 21 ##src/advio/udpserv03.c##
+ mydg_echo(sockfd, (SA *) &cliaddr, sizeof(cliaddr), (SA *) sa);## 22 ##src/advio/udpserv03.c##
+ exit(0); /* never executed */## 23 ##src/advio/udpserv03.c##
+ }## 24 ##src/advio/udpserv03.c##
+/* end udpserv1 */
+/* include udpserv2 */
+ if (ifi->ifi_flags & IFF_BROADCAST) {## 25 ##src/advio/udpserv03.c##
+ /* 4try to bind broadcast address */## 26 ##src/advio/udpserv03.c##
+ sockfd = Socket(AF_INET, SOCK_DGRAM, 0);## 27 ##src/advio/udpserv03.c##
+ Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));## 28 ##src/advio/udpserv03.c##
+
+ sa = (struct sockaddr_in *) ifi->ifi_brdaddr;## 29 ##src/advio/udpserv03.c##
+ sa->sin_family = AF_INET;## 30 ##src/advio/udpserv03.c##
+ sa->sin_port = htons(SERV_PORT);## 31 ##src/advio/udpserv03.c##
+ if (bind(sockfd, (SA *) sa, sizeof(*sa)) < 0) {## 32 ##src/advio/udpserv03.c##
+ if (errno == EADDRINUSE) {## 33 ##src/advio/udpserv03.c##
+ printf("EADDRINUSE: %s\n",## 34 ##src/advio/udpserv03.c##
+ Sock_ntop((SA *) sa, sizeof(*sa)));## 35 ##src/advio/udpserv03.c##
+ Close(sockfd);## 36 ##src/advio/udpserv03.c##
+ continue;## 37 ##src/advio/udpserv03.c##
+ } else## 38 ##src/advio/udpserv03.c##
+ err_sys("bind error for %s",## 39 ##src/advio/udpserv03.c##
+ Sock_ntop((SA *) sa, sizeof(*sa)));## 40 ##src/advio/udpserv03.c##
+ }## 41 ##src/advio/udpserv03.c##
+ printf("bound %s\n", Sock_ntop((SA *) sa, sizeof(*sa)));## 42 ##src/advio/udpserv03.c##
+
+ if ((pid = Fork()) == 0) { /* child */## 43 ##src/advio/udpserv03.c##
+ mydg_echo(sockfd, (SA *) &cliaddr, sizeof(cliaddr),## 44 ##src/advio/udpserv03.c##
+ (SA *) sa);## 45 ##src/advio/udpserv03.c##
+ exit(0); /* never executed */## 46 ##src/advio/udpserv03.c##
+ }## 47 ##src/advio/udpserv03.c##
+ }## 48 ##src/advio/udpserv03.c##
+ }## 49 ##src/advio/udpserv03.c##
+/* end udpserv2 */
+/* include udpserv3 */
+ /* 4bind wildcard address */## 50 ##src/advio/udpserv03.c##
+ sockfd = Socket(AF_INET, SOCK_DGRAM, 0);## 51 ##src/advio/udpserv03.c##
+ Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));## 52 ##src/advio/udpserv03.c##
+
+ bzero(&wildaddr, sizeof(wildaddr));## 53 ##src/advio/udpserv03.c##
+ wildaddr.sin_family = AF_INET;## 54 ##src/advio/udpserv03.c##
+ wildaddr.sin_addr.s_addr = htonl(INADDR_ANY);## 55 ##src/advio/udpserv03.c##
+ wildaddr.sin_port = htons(SERV_PORT);## 56 ##src/advio/udpserv03.c##
+ Bind(sockfd, (SA *) &wildaddr, sizeof(wildaddr));## 57 ##src/advio/udpserv03.c##
+ printf("bound %s\n", Sock_ntop((SA *) &wildaddr, sizeof(wildaddr)));## 58 ##src/advio/udpserv03.c##
+
+ if ((pid = Fork()) == 0) { /* child */## 59 ##src/advio/udpserv03.c##
+ mydg_echo(sockfd, (SA *) &cliaddr, sizeof(cliaddr), (SA *) sa);## 60 ##src/advio/udpserv03.c##
+ exit(0); /* never executed */## 61 ##src/advio/udpserv03.c##
+ }## 62 ##src/advio/udpserv03.c##
+ exit(0);## 63 ##src/advio/udpserv03.c##
+}## 64 ##src/advio/udpserv03.c##
+/* end udpserv3 */
+
+/* include mydg_echo */
+void## 65 ##src/advio/udpserv03.c##
+mydg_echo(int sockfd, SA *pcliaddr, socklen_t clilen, SA *myaddr)## 66 ##src/advio/udpserv03.c##
+{## 67 ##src/advio/udpserv03.c##
+ int n;## 68 ##src/advio/udpserv03.c##
+ char mesg[MAXLINE];## 69 ##src/advio/udpserv03.c##
+ socklen_t len;## 70 ##src/advio/udpserv03.c##
+
+ for (;;) {## 71 ##src/advio/udpserv03.c##
+ len = clilen;## 72 ##src/advio/udpserv03.c##
+ n = Recvfrom(sockfd, mesg, MAXLINE, 0, pcliaddr, &len);## 73 ##src/advio/udpserv03.c##
+ printf("child %d, datagram from %s", getpid(),## 74 ##src/advio/udpserv03.c##
+ Sock_ntop(pcliaddr, len));## 75 ##src/advio/udpserv03.c##
+ printf(", to %s\n", Sock_ntop(myaddr, clilen));## 76 ##src/advio/udpserv03.c##
+
+ Sendto(sockfd, mesg, n, 0, pcliaddr, len);## 77 ##src/advio/udpserv03.c##
+ }## 78 ##src/advio/udpserv03.c##
+}## 79 ##src/advio/udpserv03.c##
+/* end mydg_echo */
diff --git a/unix/unpv13e/advio/udpserv04.c b/unix/unpv13e/advio/udpserv04.c
new file mode 100644
index 0000000..e4f37ce
--- /dev/null
+++ b/unix/unpv13e/advio/udpserv04.c
@@ -0,0 +1,103 @@
+#include "unpifi.h"
+
+void mydg_echo(int, SA *, socklen_t);
+
+int
+main(int argc, char **argv)
+{
+ int sockfd, family, port;
+ const int on = 1;
+ pid_t pid;
+ socklen_t salen;
+ struct sockaddr *sa, *wild;
+ struct ifi_info *ifi, *ifihead;
+
+ if (argc == 2)
+ sockfd = Udp_client(NULL, argv[1], (void **) &sa, &salen);
+ else if (argc == 3)
+ sockfd = Udp_client(argv[1], argv[2], (void **) &sa, &salen);
+ else
+ err_quit("usage: udpserv04 [ ] ");
+ family = sa->sa_family;
+ port = sock_get_port(sa, salen);
+ Close(sockfd); /* we just want family, port, salen */
+
+ for (ifihead = ifi = Get_ifi_info(family, 1);
+ ifi != NULL; ifi = ifi->ifi_next) {
+
+ /*4bind unicast address */
+ sockfd = Socket(family, SOCK_DGRAM, 0);
+ Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+
+ sock_set_port(ifi->ifi_addr, salen, port);
+ Bind(sockfd, ifi->ifi_addr, salen);
+ printf("bound %s\n", Sock_ntop(ifi->ifi_addr, salen));
+
+ if ( (pid = Fork()) == 0) { /* child */
+ mydg_echo(sockfd, ifi->ifi_addr, salen);
+ exit(0); /* never executed */
+ }
+
+ if (ifi->ifi_flags & IFF_BROADCAST) {
+ /* 4try to bind broadcast address */
+ sockfd = Socket(family, SOCK_DGRAM, 0);
+ Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+
+ sock_set_port(ifi->ifi_brdaddr, salen, port);
+ if (bind(sockfd, ifi->ifi_brdaddr, salen) < 0) {
+ if (errno == EADDRINUSE) {
+ printf("EADDRINUSE: %s\n",
+ Sock_ntop(ifi->ifi_brdaddr, salen));
+ Close(sockfd);
+ continue;
+ } else
+ err_sys("bind error for %s",
+ Sock_ntop(ifi->ifi_brdaddr, salen));
+ }
+ printf("bound %s\n", Sock_ntop(ifi->ifi_brdaddr, salen));
+
+ if ( (pid = Fork()) == 0) { /* child */
+ mydg_echo(sockfd, ifi->ifi_brdaddr, salen);
+ exit(0); /* never executed */
+ }
+ }
+ }
+
+ /* 4bind wildcard address */
+ sockfd = Socket(family, SOCK_DGRAM, 0);
+ Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
+
+ wild = Malloc(salen);
+ memcpy(wild, sa, salen); /* copy family and port */
+ sock_set_wild(wild, salen);
+
+ Bind(sockfd, wild, salen);
+ printf("bound %s\n", Sock_ntop(wild, salen));
+
+ if ( (pid = Fork()) == 0) { /* child */
+ mydg_echo(sockfd, wild, salen);
+ exit(0); /* never executed */
+ }
+ exit(0);
+}
+
+void
+mydg_echo(int sockfd, SA *myaddr, socklen_t salen)
+{
+ int n;
+ char mesg[MAXLINE];
+ socklen_t len;
+ struct sockaddr *cli;
+
+ cli = Malloc(salen);
+
+ for ( ; ; ) {
+ len = salen;
+ n = Recvfrom(sockfd, mesg, MAXLINE, 0, cli, &len);
+ printf("child %d, datagram from %s",
+ getpid(), Sock_ntop(cli, len));
+ printf(", to %s\n", Sock_ntop(myaddr, salen));
+
+ Sendto(sockfd, mesg, n, 0, cli, len);
+ }
+}
diff --git a/unix/unpv13e/advio/udpserv04.lc b/unix/unpv13e/advio/udpserv04.lc
new file mode 100644
index 0000000..b20a60b
--- /dev/null
+++ b/unix/unpv13e/advio/udpserv04.lc
@@ -0,0 +1,102 @@
+#include "unpifi.h"## 1 ##src/advio/udpserv04.c##
+
+void mydg_echo(int, SA *, socklen_t);## 2 ##src/advio/udpserv04.c##
+
+int## 3 ##src/advio/udpserv04.c##
+main(int argc, char **argv)## 4 ##src/advio/udpserv04.c##
+{## 5 ##src/advio/udpserv04.c##
+ int sockfd, family, port;## 6 ##src/advio/udpserv04.c##
+ const int on = 1;## 7 ##src/advio/udpserv04.c##
+ pid_t pid;## 8 ##src/advio/udpserv04.c##
+ socklen_t salen;## 9 ##src/advio/udpserv04.c##
+ struct sockaddr *sa, *wild;## 10 ##src/advio/udpserv04.c##
+ struct ifi_info *ifi, *ifihead;## 11 ##src/advio/udpserv04.c##
+
+ if (argc == 2)## 12 ##src/advio/udpserv04.c##
+ sockfd = Udp_client(NULL, argv[1], (void **) &sa, &salen);## 13 ##src/advio/udpserv04.c##
+ else if (argc == 3)## 14 ##src/advio/udpserv04.c##
+ sockfd = Udp_client(argv[1], argv[2], (void **) &sa, &salen);## 15 ##src/advio/udpserv04.c##
+ else## 16 ##src/advio/udpserv04.c##
+ err_quit("usage: udpserv04 [ ] ");## 17 ##src/advio/udpserv04.c##
+ family = sa->sa_family;## 18 ##src/advio/udpserv04.c##
+ port = sock_get_port(sa, salen);## 19 ##src/advio/udpserv04.c##
+ Close(sockfd); /* we just want family, port, salen */## 20 ##src/advio/udpserv04.c##
+
+ for (ifihead = ifi = Get_ifi_info(family, 1);## 21 ##src/advio/udpserv04.c##
+ ifi != NULL; ifi = ifi->ifi_next) {## 22 ##src/advio/udpserv04.c##
+
+ /* 4bind unicast address */## 23 ##src/advio/udpserv04.c##
+ sockfd = Socket(family, SOCK_DGRAM, 0);## 24 ##src/advio/udpserv04.c##
+ Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));## 25 ##src/advio/udpserv04.c##
+
+ sock_set_port(ifi->ifi_addr, salen, port);## 26 ##src/advio/udpserv04.c##
+ Bind(sockfd, ifi->ifi_addr, salen);## 27 ##src/advio/udpserv04.c##
+ printf("bound %s\n", Sock_ntop(ifi->ifi_addr, salen));## 28 ##src/advio/udpserv04.c##
+
+ if ((pid = Fork()) == 0) { /* child */## 29 ##src/advio/udpserv04.c##
+ mydg_echo(sockfd, ifi->ifi_addr, salen);## 30 ##src/advio/udpserv04.c##
+ exit(0); /* never executed */## 31 ##src/advio/udpserv04.c##
+ }## 32 ##src/advio/udpserv04.c##
+
+ if (ifi->ifi_flags & IFF_BROADCAST) {## 33 ##src/advio/udpserv04.c##
+ /* 4try to bind broadcast address */## 34 ##src/advio/udpserv04.c##
+ sockfd = Socket(family, SOCK_DGRAM, 0);## 35 ##src/advio/udpserv04.c##
+ Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));## 36 ##src/advio/udpserv04.c##
+
+ sock_set_port(ifi->ifi_brdaddr, salen, port);## 37 ##src/advio/udpserv04.c##
+ if (bind(sockfd, ifi->ifi_brdaddr, salen) < 0) {## 38 ##src/advio/udpserv04.c##
+ if (errno == EADDRINUSE) {## 39 ##src/advio/udpserv04.c##
+ printf("EADDRINUSE: %s\n",## 40 ##src/advio/udpserv04.c##
+ Sock_ntop(ifi->ifi_brdaddr, salen));## 41 ##src/advio/udpserv04.c##
+ Close(sockfd);## 42 ##src/advio/udpserv04.c##
+ continue;## 43 ##src/advio/udpserv04.c##
+ } else## 44 ##src/advio/udpserv04.c##
+ err_sys("bind error for %s",## 45 ##src/advio/udpserv04.c##
+ Sock_ntop(ifi->ifi_brdaddr, salen));## 46 ##src/advio/udpserv04.c##
+ }## 47 ##src/advio/udpserv04.c##
+ printf("bound %s\n", Sock_ntop(ifi->ifi_brdaddr, salen));## 48 ##src/advio/udpserv04.c##
+
+ if ((pid = Fork()) == 0) { /* child */## 49 ##src/advio/udpserv04.c##
+ mydg_echo(sockfd, ifi->ifi_brdaddr, salen);## 50 ##src/advio/udpserv04.c##
+ exit(0); /* never executed */## 51 ##src/advio/udpserv04.c##
+ }## 52 ##src/advio/udpserv04.c##
+ }## 53 ##src/advio/udpserv04.c##
+ }## 54 ##src/advio/udpserv04.c##
+
+ /* 4bind wildcard address */## 55 ##src/advio/udpserv04.c##
+ sockfd = Socket(family, SOCK_DGRAM, 0);## 56 ##src/advio/udpserv04.c##
+ Setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));## 57 ##src/advio/udpserv04.c##
+
+ wild = Malloc(salen);## 58 ##src/advio/udpserv04.c##
+ memcpy(wild, sa, salen); /* copy family and port */## 59 ##src/advio/udpserv04.c##
+ sock_set_wild(wild, salen);## 60 ##src/advio/udpserv04.c##
+
+ Bind(sockfd, wild, salen);## 61 ##src/advio/udpserv04.c##
+ printf("bound %s\n", Sock_ntop(wild, salen));## 62 ##src/advio/udpserv04.c##
+
+ if ((pid = Fork()) == 0) { /* child */## 63 ##src/advio/udpserv04.c##
+ mydg_echo(sockfd, wild, salen);## 64 ##src/advio/udpserv04.c##
+ exit(0); /* never executed */## 65 ##src/advio/udpserv04.c##
+ }## 66 ##src/advio/udpserv04.c##
+ exit(0);## 67 ##src/advio/udpserv04.c##
+}## 68 ##src/advio/udpserv04.c##
+
+void## 69 ##src/advio/udpserv04.c##
+mydg_echo(int sockfd, SA *myaddr, socklen_t salen)## 70 ##src/advio/udpserv04.c##
+{## 71 ##src/advio/udpserv04.c##
+ int n;## 72 ##src/advio/udpserv04.c##
+ char mesg[MAXLINE];## 73 ##src/advio/udpserv04.c##
+ socklen_t len;## 74 ##src/advio/udpserv04.c##
+ struct sockaddr *cli;## 75 ##src/advio/udpserv04.c##
+
+ cli = Malloc(salen);## 76 ##src/advio/udpserv04.c##
+
+ for (;;) {## 77 ##src/advio/udpserv04.c##
+ len = salen;## 78 ##src/advio/udpserv04.c##
+ n = Recvfrom(sockfd, mesg, MAXLINE, 0, cli, &len);## 79 ##src/advio/udpserv04.c##
+ printf("child %d, datagram from %s", getpid(), Sock_ntop(cli, len));## 80 ##src/advio/udpserv04.c##
+ printf(", to %s\n", Sock_ntop(myaddr, salen));## 81 ##src/advio/udpserv04.c##
+
+ Sendto(sockfd, mesg, n, 0, cli, len);## 82 ##src/advio/udpserv04.c##
+ }## 83 ##src/advio/udpserv04.c##
+}## 84 ##src/advio/udpserv04.c##
diff --git a/unix/unpv13e/bcast/Makefile b/unix/unpv13e/bcast/Makefile
new file mode 100644
index 0000000..022ce69
--- /dev/null
+++ b/unix/unpv13e/bcast/Makefile
@@ -0,0 +1,32 @@
+include ../Make.defines
+
+PROGS = udpcli01 udpcli02 udpcli03 udpcli04 udpcli05 udpcli06
+
+all: ${PROGS}
+
+# Version in book.
+udpcli01: udpcli01.o dgclibcast1.o
+ ${CC} ${CFLAGS} -o $@ udpcli01.o dgclibcast1.o ${LIBS}
+
+# Incorrect version with alarm(1) and sleep(1) to tickle race condition.
+udpcli02: udpcli02.o dgclibcast2.o
+ ${CC} ${CFLAGS} -o $@ udpcli02.o dgclibcast2.o ${LIBS}
+
+# Incorrect version that blocks signals, but still has a race condition.
+udpcli03: udpcli03.o dgclibcast3.o
+ ${CC} ${CFLAGS} -o $@ udpcli03.o dgclibcast3.o ${LIBS}
+
+# Correct version using pselect().
+udpcli04: udpcli04.o dgclibcast4.o
+ ${CC} ${CFLAGS} -o $@ udpcli04.o dgclibcast4.o ${LIBS}
+
+# Correct version using sigsetjmp()/siglongjmp().
+udpcli05: udpcli05.o dgclibcast5.o
+ ${CC} ${CFLAGS} -o $@ udpcli05.o dgclibcast5.o ${LIBS}
+
+# Correct version using a pipe from signal handler to select().
+udpcli06: udpcli06.o dgclibcast6.o
+ ${CC} ${CFLAGS} -o $@ udpcli06.o dgclibcast6.o ${LIBS}
+
+clean:
+ rm -f ${PROGS} ${CLEANFILES}
diff --git a/unix/unpv13e/bcast/dgclibcast1.c b/unix/unpv13e/bcast/dgclibcast1.c
new file mode 100644
index 0000000..2889f0a
--- /dev/null
+++ b/unix/unpv13e/bcast/dgclibcast1.c
@@ -0,0 +1,47 @@
+#include "unp.h"
+
+static void recvfrom_alarm(int);
+
+void
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
+{
+ int n;
+ const int on = 1;
+ char sendline[MAXLINE], recvline[MAXLINE + 1];
+ socklen_t len;
+ struct sockaddr *preply_addr;
+
+ preply_addr = Malloc(servlen);
+
+ Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
+
+ Signal(SIGALRM, recvfrom_alarm);
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {
+
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
+
+ alarm(5);
+ for ( ; ; ) {
+ len = servlen;
+ n = recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);
+ if (n < 0) {
+ if (errno == EINTR)
+ break; /* waited long enough for replies */
+ else
+ err_sys("recvfrom error");
+ } else {
+ recvline[n] = 0; /* null terminate */
+ printf("from %s: %s",
+ Sock_ntop_host(preply_addr, len), recvline);
+ }
+ }
+ }
+ free(preply_addr);
+}
+
+static void
+recvfrom_alarm(int signo)
+{
+ return; /* just interrupt the recvfrom() */
+}
diff --git a/unix/unpv13e/bcast/dgclibcast1.lc b/unix/unpv13e/bcast/dgclibcast1.lc
new file mode 100644
index 0000000..5680acc
--- /dev/null
+++ b/unix/unpv13e/bcast/dgclibcast1.lc
@@ -0,0 +1,46 @@
+#include "unp.h"## 1 ##src/bcast/dgclibcast1.c##
+
+static void recvfrom_alarm(int);## 2 ##src/bcast/dgclibcast1.c##
+
+void## 3 ##src/bcast/dgclibcast1.c##
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)## 4 ##src/bcast/dgclibcast1.c##
+{## 5 ##src/bcast/dgclibcast1.c##
+ int n;## 6 ##src/bcast/dgclibcast1.c##
+ const int on = 1;## 7 ##src/bcast/dgclibcast1.c##
+ char sendline[MAXLINE], recvline[MAXLINE + 1];## 8 ##src/bcast/dgclibcast1.c##
+ socklen_t len;## 9 ##src/bcast/dgclibcast1.c##
+ struct sockaddr *preply_addr;## 10 ##src/bcast/dgclibcast1.c##
+
+ preply_addr = Malloc(servlen);## 11 ##src/bcast/dgclibcast1.c##
+
+ Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));## 12 ##src/bcast/dgclibcast1.c##
+
+ Signal(SIGALRM, recvfrom_alarm);## 13 ##src/bcast/dgclibcast1.c##
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {## 14 ##src/bcast/dgclibcast1.c##
+
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);## 15 ##src/bcast/dgclibcast1.c##
+
+ alarm(5);## 16 ##src/bcast/dgclibcast1.c##
+ for (;;) {## 17 ##src/bcast/dgclibcast1.c##
+ len = servlen;## 18 ##src/bcast/dgclibcast1.c##
+ n = recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);## 19 ##src/bcast/dgclibcast1.c##
+ if (n < 0) {## 20 ##src/bcast/dgclibcast1.c##
+ if (errno == EINTR)## 21 ##src/bcast/dgclibcast1.c##
+ break; /* waited long enough for replies */## 22 ##src/bcast/dgclibcast1.c##
+ else## 23 ##src/bcast/dgclibcast1.c##
+ err_sys("recvfrom error");## 24 ##src/bcast/dgclibcast1.c##
+ } else {## 25 ##src/bcast/dgclibcast1.c##
+ recvline[n] = 0; /* null terminate */## 26 ##src/bcast/dgclibcast1.c##
+ printf("from %s: %s",## 27 ##src/bcast/dgclibcast1.c##
+ Sock_ntop_host(preply_addr, len), recvline);## 28 ##src/bcast/dgclibcast1.c##
+ }## 29 ##src/bcast/dgclibcast1.c##
+ }## 30 ##src/bcast/dgclibcast1.c##
+ }## 31 ##src/bcast/dgclibcast1.c##
+}## 32 ##src/bcast/dgclibcast1.c##
+
+static void## 33 ##src/bcast/dgclibcast1.c##
+recvfrom_alarm(int signo)## 34 ##src/bcast/dgclibcast1.c##
+{## 35 ##src/bcast/dgclibcast1.c##
+ return; /* just interrupt the recvfrom() */## 36 ##src/bcast/dgclibcast1.c##
+}## 37 ##src/bcast/dgclibcast1.c##
diff --git a/unix/unpv13e/bcast/dgclibcast2.c b/unix/unpv13e/bcast/dgclibcast2.c
new file mode 100644
index 0000000..8a75094
--- /dev/null
+++ b/unix/unpv13e/bcast/dgclibcast2.c
@@ -0,0 +1,48 @@
+#include "unp.h"
+
+static void recvfrom_alarm(int);
+
+void
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
+{
+ int n;
+ const int on = 1;
+ char sendline[MAXLINE], recvline[MAXLINE + 1];
+ socklen_t len;
+ struct sockaddr *preply_addr;
+
+ preply_addr = Malloc(servlen);
+
+ Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
+
+ Signal(SIGALRM, recvfrom_alarm);
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {
+
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
+
+ alarm(1);
+ for ( ; ; ) {
+ len = servlen;
+ n = recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);
+ if (n == -1) {
+ if (errno == EINTR)
+ break; /* waited long enough for replies */
+ else
+ err_sys("recvfrom error");
+ } else {
+ recvline[n] = 0; /* null terminate */
+ sleep(1);
+ printf("from %s: %s",
+ Sock_ntop_host(preply_addr, len), recvline);
+ }
+ }
+ }
+ free(preply_addr);
+}
+
+static void
+recvfrom_alarm(int signo)
+{
+ return; /* just interrupt the recvfrom() */
+}
diff --git a/unix/unpv13e/bcast/dgclibcast3.c b/unix/unpv13e/bcast/dgclibcast3.c
new file mode 100644
index 0000000..ef1354f
--- /dev/null
+++ b/unix/unpv13e/bcast/dgclibcast3.c
@@ -0,0 +1,53 @@
+#include "unp.h"
+
+static void recvfrom_alarm(int);
+
+void
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
+{
+ int n;
+ const int on = 1;
+ char sendline[MAXLINE], recvline[MAXLINE + 1];
+ sigset_t sigset_alrm;
+ socklen_t len;
+ struct sockaddr *preply_addr;
+
+ preply_addr = Malloc(servlen);
+
+ Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
+
+ Sigemptyset(&sigset_alrm);
+ Sigaddset(&sigset_alrm, SIGALRM);
+
+ Signal(SIGALRM, recvfrom_alarm);
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {
+
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
+
+ alarm(5);
+ for ( ; ; ) {
+ len = servlen;
+ Sigprocmask(SIG_UNBLOCK, &sigset_alrm, NULL);
+ n = recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);
+ Sigprocmask(SIG_BLOCK, &sigset_alrm, NULL);
+ if (n < 0) {
+ if (errno == EINTR)
+ break; /* waited long enough for replies */
+ else
+ err_sys("recvfrom error");
+ } else {
+ recvline[n] = 0; /* null terminate */
+ printf("from %s: %s",
+ Sock_ntop_host(preply_addr, len), recvline);
+ }
+ }
+ }
+ free(preply_addr);
+}
+
+static void
+recvfrom_alarm(int signo)
+{
+ return; /* just interrupt the recvfrom() */
+}
diff --git a/unix/unpv13e/bcast/dgclibcast3.lc b/unix/unpv13e/bcast/dgclibcast3.lc
new file mode 100644
index 0000000..711841e
--- /dev/null
+++ b/unix/unpv13e/bcast/dgclibcast3.lc
@@ -0,0 +1,52 @@
+#include "unp.h"## 1 ##src/bcast/dgclibcast3.c##
+
+static void recvfrom_alarm(int);## 2 ##src/bcast/dgclibcast3.c##
+
+void## 3 ##src/bcast/dgclibcast3.c##
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)## 4 ##src/bcast/dgclibcast3.c##
+{## 5 ##src/bcast/dgclibcast3.c##
+ int n;## 6 ##src/bcast/dgclibcast3.c##
+ const int on = 1;## 7 ##src/bcast/dgclibcast3.c##
+ char sendline[MAXLINE], recvline[MAXLINE + 1];## 8 ##src/bcast/dgclibcast3.c##
+ sigset_t sigset_alrm;## 9 ##src/bcast/dgclibcast3.c##
+ socklen_t len;## 10 ##src/bcast/dgclibcast3.c##
+ struct sockaddr *preply_addr;## 11 ##src/bcast/dgclibcast3.c##
+
+ preply_addr = Malloc(servlen);## 12 ##src/bcast/dgclibcast3.c##
+
+ Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));## 13 ##src/bcast/dgclibcast3.c##
+
+ Sigemptyset(&sigset_alrm);## 14 ##src/bcast/dgclibcast3.c##
+ Sigaddset(&sigset_alrm, SIGALRM);## 15 ##src/bcast/dgclibcast3.c##
+
+ Signal(SIGALRM, recvfrom_alarm);## 16 ##src/bcast/dgclibcast3.c##
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {## 17 ##src/bcast/dgclibcast3.c##
+
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);## 18 ##src/bcast/dgclibcast3.c##
+
+ alarm(5);## 19 ##src/bcast/dgclibcast3.c##
+ for (;;) {## 20 ##src/bcast/dgclibcast3.c##
+ len = servlen;## 21 ##src/bcast/dgclibcast3.c##
+ Sigprocmask(SIG_UNBLOCK, &sigset_alrm, NULL);## 22 ##src/bcast/dgclibcast3.c##
+ n = recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);## 23 ##src/bcast/dgclibcast3.c##
+ Sigprocmask(SIG_BLOCK, &sigset_alrm, NULL);## 24 ##src/bcast/dgclibcast3.c##
+ if (n < 0) {## 25 ##src/bcast/dgclibcast3.c##
+ if (errno == EINTR)## 26 ##src/bcast/dgclibcast3.c##
+ break; /* waited long enough for replies */## 27 ##src/bcast/dgclibcast3.c##
+ else## 28 ##src/bcast/dgclibcast3.c##
+ err_sys("recvfrom error");## 29 ##src/bcast/dgclibcast3.c##
+ } else {## 30 ##src/bcast/dgclibcast3.c##
+ recvline[n] = 0; /* null terminate */## 31 ##src/bcast/dgclibcast3.c##
+ printf("from %s: %s",## 32 ##src/bcast/dgclibcast3.c##
+ Sock_ntop_host(preply_addr, len), recvline);## 33 ##src/bcast/dgclibcast3.c##
+ }## 34 ##src/bcast/dgclibcast3.c##
+ }## 35 ##src/bcast/dgclibcast3.c##
+ }## 36 ##src/bcast/dgclibcast3.c##
+}## 37 ##src/bcast/dgclibcast3.c##
+
+static void## 38 ##src/bcast/dgclibcast3.c##
+recvfrom_alarm(int signo)## 39 ##src/bcast/dgclibcast3.c##
+{## 40 ##src/bcast/dgclibcast3.c##
+ return; /* just interrupt the recvfrom() */## 41 ##src/bcast/dgclibcast3.c##
+}## 42 ##src/bcast/dgclibcast3.c##
diff --git a/unix/unpv13e/bcast/dgclibcast4.c b/unix/unpv13e/bcast/dgclibcast4.c
new file mode 100644
index 0000000..85656b9
--- /dev/null
+++ b/unix/unpv13e/bcast/dgclibcast4.c
@@ -0,0 +1,58 @@
+#include "unp.h"
+
+static void recvfrom_alarm(int);
+
+void
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
+{
+ int n;
+ const int on = 1;
+ char sendline[MAXLINE], recvline[MAXLINE + 1];
+ fd_set rset;
+ sigset_t sigset_alrm, sigset_empty;
+ socklen_t len;
+ struct sockaddr *preply_addr;
+
+ preply_addr = Malloc(servlen);
+
+ Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
+
+ FD_ZERO(&rset);
+
+ Sigemptyset(&sigset_empty);
+ Sigemptyset(&sigset_alrm);
+ Sigaddset(&sigset_alrm, SIGALRM);
+
+ Signal(SIGALRM, recvfrom_alarm);
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
+
+ Sigprocmask(SIG_BLOCK, &sigset_alrm, NULL);
+ alarm(5);
+ for ( ; ; ) {
+ FD_SET(sockfd, &rset);
+ n = pselect(sockfd+1, &rset, NULL, NULL, NULL, &sigset_empty);
+ if (n < 0) {
+ if (errno == EINTR)
+ break;
+ else
+ err_sys("pselect error");
+ } else if (n != 1)
+ err_sys("pselect error: returned %d", n);
+
+ len = servlen;
+ n = Recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);
+ recvline[n] = 0; /* null terminate */
+ printf("from %s: %s",
+ Sock_ntop_host(preply_addr, len), recvline);
+ }
+ }
+ free(preply_addr);
+}
+
+static void
+recvfrom_alarm(int signo)
+{
+ return; /* just interrupt the recvfrom() */
+}
diff --git a/unix/unpv13e/bcast/dgclibcast4.lc b/unix/unpv13e/bcast/dgclibcast4.lc
new file mode 100644
index 0000000..09f1d9f
--- /dev/null
+++ b/unix/unpv13e/bcast/dgclibcast4.lc
@@ -0,0 +1,57 @@
+#include "unp.h"## 1 ##src/bcast/dgclibcast4.c##
+
+static void recvfrom_alarm(int);## 2 ##src/bcast/dgclibcast4.c##
+
+void## 3 ##src/bcast/dgclibcast4.c##
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)## 4 ##src/bcast/dgclibcast4.c##
+{## 5 ##src/bcast/dgclibcast4.c##
+ int n;## 6 ##src/bcast/dgclibcast4.c##
+ const int on = 1;## 7 ##src/bcast/dgclibcast4.c##
+ char sendline[MAXLINE], recvline[MAXLINE + 1];## 8 ##src/bcast/dgclibcast4.c##
+ fd_set rset;## 9 ##src/bcast/dgclibcast4.c##
+ sigset_t sigset_alrm, sigset_empty;## 10 ##src/bcast/dgclibcast4.c##
+ socklen_t len;## 11 ##src/bcast/dgclibcast4.c##
+ struct sockaddr *preply_addr;## 12 ##src/bcast/dgclibcast4.c##
+
+ preply_addr = Malloc(servlen);## 13 ##src/bcast/dgclibcast4.c##
+
+ Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));## 14 ##src/bcast/dgclibcast4.c##
+
+ FD_ZERO(&rset);## 15 ##src/bcast/dgclibcast4.c##
+
+ Sigemptyset(&sigset_empty);## 16 ##src/bcast/dgclibcast4.c##
+ Sigemptyset(&sigset_alrm);## 17 ##src/bcast/dgclibcast4.c##
+ Sigaddset(&sigset_alrm, SIGALRM);## 18 ##src/bcast/dgclibcast4.c##
+
+ Signal(SIGALRM, recvfrom_alarm);## 19 ##src/bcast/dgclibcast4.c##
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {## 20 ##src/bcast/dgclibcast4.c##
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);## 21 ##src/bcast/dgclibcast4.c##
+
+ Sigprocmask(SIG_BLOCK, &sigset_alrm, NULL);## 22 ##src/bcast/dgclibcast4.c##
+ alarm(5);## 23 ##src/bcast/dgclibcast4.c##
+ for (;;) {## 24 ##src/bcast/dgclibcast4.c##
+ FD_SET(sockfd, &rset);## 25 ##src/bcast/dgclibcast4.c##
+ n = pselect(sockfd + 1, &rset, NULL, NULL, NULL, &sigset_empty);## 26 ##src/bcast/dgclibcast4.c##
+ if (n < 0) {## 27 ##src/bcast/dgclibcast4.c##
+ if (errno == EINTR)## 28 ##src/bcast/dgclibcast4.c##
+ break;## 29 ##src/bcast/dgclibcast4.c##
+ else## 30 ##src/bcast/dgclibcast4.c##
+ err_sys("pselect error");## 31 ##src/bcast/dgclibcast4.c##
+ } else if (n != 1)## 32 ##src/bcast/dgclibcast4.c##
+ err_sys("pselect error: returned %d", n);## 33 ##src/bcast/dgclibcast4.c##
+
+ len = servlen;## 34 ##src/bcast/dgclibcast4.c##
+ n = Recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);## 35 ##src/bcast/dgclibcast4.c##
+ recvline[n] = 0; /* null terminate */## 36 ##src/bcast/dgclibcast4.c##
+ printf("from %s: %s",## 37 ##src/bcast/dgclibcast4.c##
+ Sock_ntop_host(preply_addr, len), recvline);## 38 ##src/bcast/dgclibcast4.c##
+ }## 39 ##src/bcast/dgclibcast4.c##
+ }## 40 ##src/bcast/dgclibcast4.c##
+}## 41 ##src/bcast/dgclibcast4.c##
+
+static void## 42 ##src/bcast/dgclibcast4.c##
+recvfrom_alarm(int signo)## 43 ##src/bcast/dgclibcast4.c##
+{## 44 ##src/bcast/dgclibcast4.c##
+ return; /* just interrupt the recvfrom() */## 45 ##src/bcast/dgclibcast4.c##
+}## 46 ##src/bcast/dgclibcast4.c##
diff --git a/unix/unpv13e/bcast/dgclibcast5.c b/unix/unpv13e/bcast/dgclibcast5.c
new file mode 100644
index 0000000..edfe12c
--- /dev/null
+++ b/unix/unpv13e/bcast/dgclibcast5.c
@@ -0,0 +1,44 @@
+#include "unp.h"
+#include
+
+static void recvfrom_alarm(int);
+static sigjmp_buf jmpbuf;
+
+void
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
+{
+ int n;
+ const int on = 1;
+ char sendline[MAXLINE], recvline[MAXLINE + 1];
+ socklen_t len;
+ struct sockaddr *preply_addr;
+
+ preply_addr = Malloc(servlen);
+
+ Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
+
+ Signal(SIGALRM, recvfrom_alarm);
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {
+
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
+
+ alarm(5);
+ for ( ; ; ) {
+ if (sigsetjmp(jmpbuf, 1) != 0)
+ break;
+ len = servlen;
+ n = Recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);
+ recvline[n] = 0; /* null terminate */
+ printf("from %s: %s",
+ Sock_ntop_host(preply_addr, len), recvline);
+ }
+ }
+ free(preply_addr);
+}
+
+static void
+recvfrom_alarm(int signo)
+{
+ siglongjmp(jmpbuf, 1);
+}
diff --git a/unix/unpv13e/bcast/dgclibcast5.lc b/unix/unpv13e/bcast/dgclibcast5.lc
new file mode 100644
index 0000000..dfac0b2
--- /dev/null
+++ b/unix/unpv13e/bcast/dgclibcast5.lc
@@ -0,0 +1,43 @@
+#include "unp.h"## 1 ##src/bcast/dgclibcast5.c##
+#include ## 2 ##src/bcast/dgclibcast5.c##
+
+static void recvfrom_alarm(int);## 3 ##src/bcast/dgclibcast5.c##
+static sigjmp_buf jmpbuf;## 4 ##src/bcast/dgclibcast5.c##
+
+void## 5 ##src/bcast/dgclibcast5.c##
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)## 6 ##src/bcast/dgclibcast5.c##
+{## 7 ##src/bcast/dgclibcast5.c##
+ int n;## 8 ##src/bcast/dgclibcast5.c##
+ const int on = 1;## 9 ##src/bcast/dgclibcast5.c##
+ char sendline[MAXLINE], recvline[MAXLINE + 1];## 10 ##src/bcast/dgclibcast5.c##
+ socklen_t len;## 11 ##src/bcast/dgclibcast5.c##
+ struct sockaddr *preply_addr;## 12 ##src/bcast/dgclibcast5.c##
+
+ preply_addr = Malloc(servlen);## 13 ##src/bcast/dgclibcast5.c##
+
+ Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));## 14 ##src/bcast/dgclibcast5.c##
+
+ Signal(SIGALRM, recvfrom_alarm);## 15 ##src/bcast/dgclibcast5.c##
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {## 16 ##src/bcast/dgclibcast5.c##
+
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);## 17 ##src/bcast/dgclibcast5.c##
+
+ alarm(5);## 18 ##src/bcast/dgclibcast5.c##
+ for (;;) {## 19 ##src/bcast/dgclibcast5.c##
+ if (sigsetjmp(jmpbuf, 1) != 0)## 20 ##src/bcast/dgclibcast5.c##
+ break;## 21 ##src/bcast/dgclibcast5.c##
+ len = servlen;## 22 ##src/bcast/dgclibcast5.c##
+ n = Recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);## 23 ##src/bcast/dgclibcast5.c##
+ recvline[n] = 0; /* null terminate */## 24 ##src/bcast/dgclibcast5.c##
+ printf("from %s: %s",## 25 ##src/bcast/dgclibcast5.c##
+ Sock_ntop_host(preply_addr, len), recvline);## 26 ##src/bcast/dgclibcast5.c##
+ }## 27 ##src/bcast/dgclibcast5.c##
+ }## 28 ##src/bcast/dgclibcast5.c##
+}## 29 ##src/bcast/dgclibcast5.c##
+
+static void## 30 ##src/bcast/dgclibcast5.c##
+recvfrom_alarm(int signo)## 31 ##src/bcast/dgclibcast5.c##
+{## 32 ##src/bcast/dgclibcast5.c##
+ siglongjmp(jmpbuf, 1);## 33 ##src/bcast/dgclibcast5.c##
+}## 34 ##src/bcast/dgclibcast5.c##
diff --git a/unix/unpv13e/bcast/dgclibcast6.c b/unix/unpv13e/bcast/dgclibcast6.c
new file mode 100644
index 0000000..1e6e1ed
--- /dev/null
+++ b/unix/unpv13e/bcast/dgclibcast6.c
@@ -0,0 +1,63 @@
+#include "unp.h"
+
+static void recvfrom_alarm(int);
+static int pipefd[2];
+
+void
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)
+{
+ int n, maxfdp1;
+ const int on = 1;
+ char sendline[MAXLINE], recvline[MAXLINE + 1];
+ fd_set rset;
+ socklen_t len;
+ struct sockaddr *preply_addr;
+
+ preply_addr = Malloc(servlen);
+
+ Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));
+
+ Pipe(pipefd);
+ maxfdp1 = max(sockfd, pipefd[0]) + 1;
+
+ FD_ZERO(&rset);
+
+ Signal(SIGALRM, recvfrom_alarm);
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);
+
+ alarm(5);
+ for ( ; ; ) {
+ FD_SET(sockfd, &rset);
+ FD_SET(pipefd[0], &rset);
+ if ( (n = select(maxfdp1, &rset, NULL, NULL, NULL)) < 0) {
+ if (errno == EINTR)
+ continue;
+ else
+ err_sys("select error");
+ }
+
+ if (FD_ISSET(sockfd, &rset)) {
+ len = servlen;
+ n = Recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr, &len);
+ recvline[n] = 0; /* null terminate */
+ printf("from %s: %s",
+ Sock_ntop_host(preply_addr, len), recvline);
+ }
+
+ if (FD_ISSET(pipefd[0], &rset)) {
+ Read(pipefd[0], &n, 1); /* timer expired */
+ break;
+ }
+ }
+ }
+ free(preply_addr);
+}
+
+static void
+recvfrom_alarm(int signo)
+{
+ Write(pipefd[1], "", 1); /* write one null byte to pipe */
+ return;
+}
diff --git a/unix/unpv13e/bcast/dgclibcast6.lc b/unix/unpv13e/bcast/dgclibcast6.lc
new file mode 100644
index 0000000..cbd1ac1
--- /dev/null
+++ b/unix/unpv13e/bcast/dgclibcast6.lc
@@ -0,0 +1,63 @@
+#include "unp.h"## 1 ##src/bcast/dgclibcast6.c##
+
+static void recvfrom_alarm(int);## 2 ##src/bcast/dgclibcast6.c##
+static int pipefd[2];## 3 ##src/bcast/dgclibcast6.c##
+
+void## 4 ##src/bcast/dgclibcast6.c##
+dg_cli(FILE *fp, int sockfd, const SA *pservaddr, socklen_t servlen)## 5 ##src/bcast/dgclibcast6.c##
+{## 6 ##src/bcast/dgclibcast6.c##
+ int n, maxfdp1;## 7 ##src/bcast/dgclibcast6.c##
+ const int on = 1;## 8 ##src/bcast/dgclibcast6.c##
+ char sendline[MAXLINE], recvline[MAXLINE + 1];## 9 ##src/bcast/dgclibcast6.c##
+ fd_set rset;## 10 ##src/bcast/dgclibcast6.c##
+ socklen_t len;## 11 ##src/bcast/dgclibcast6.c##
+ struct sockaddr *preply_addr;## 12 ##src/bcast/dgclibcast6.c##
+
+ preply_addr = Malloc(servlen);## 13 ##src/bcast/dgclibcast6.c##
+
+ Setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on));## 14 ##src/bcast/dgclibcast6.c##
+
+ Pipe(pipefd);## 15 ##src/bcast/dgclibcast6.c##
+ maxfdp1 = max(sockfd, pipefd[0]) + 1;## 16 ##src/bcast/dgclibcast6.c##
+
+ FD_ZERO(&rset);## 17 ##src/bcast/dgclibcast6.c##
+
+ Signal(SIGALRM, recvfrom_alarm);## 18 ##src/bcast/dgclibcast6.c##
+
+ while (Fgets(sendline, MAXLINE, fp) != NULL) {## 19 ##src/bcast/dgclibcast6.c##
+ Sendto(sockfd, sendline, strlen(sendline), 0, pservaddr, servlen);## 20 ##src/bcast/dgclibcast6.c##
+
+ alarm(5);## 21 ##src/bcast/dgclibcast6.c##
+ for (;;) {## 22 ##src/bcast/dgclibcast6.c##
+ FD_SET(sockfd, &rset);## 23 ##src/bcast/dgclibcast6.c##
+ FD_SET(pipefd[0], &rset);## 24 ##src/bcast/dgclibcast6.c##
+ if ((n = select(maxfdp1, &rset, NULL, NULL, NULL)) < 0) {## 25 ##src/bcast/dgclibcast6.c##
+ if (errno == EINTR)## 26 ##src/bcast/dgclibcast6.c##
+ continue;## 27 ##src/bcast/dgclibcast6.c##
+ else## 28 ##src/bcast/dgclibcast6.c##
+ err_sys("select error");## 29 ##src/bcast/dgclibcast6.c##
+ }## 30 ##src/bcast/dgclibcast6.c##
+
+ if (FD_ISSET(sockfd, &rset)) {## 31 ##src/bcast/dgclibcast6.c##
+ len = servlen;## 32 ##src/bcast/dgclibcast6.c##
+ n = Recvfrom(sockfd, recvline, MAXLINE, 0, preply_addr,## 33 ##src/bcast/dgclibcast6.c##
+ &len);## 34 ##src/bcast/dgclibcast6.c##
+ recvline[n] = 0; /* null terminate */## 35 ##src/bcast/dgclibcast6.c##
+ printf("from %s: %s",## 36 ##src/bcast/dgclibcast6.c##
+ Sock_ntop_host(preply_addr, len), recvline);## 37 ##src/bcast/dgclibcast6.c##
+ }## 38 ##src/bcast/dgclibcast6.c##
+
+ if (FD_ISSET(pipefd[0], &rset)) {## 39 ##src/bcast/dgclibcast6.c##
+ Read(pipefd[0], &n, 1); /* timer expired */## 40 ##src/bcast/dgclibcast6.c##
+ break;## 41 ##src/bcast/dgclibcast6.c##
+ }## 42 ##src/bcast/dgclibcast6.c##
+ }## 43 ##src/bcast/dgclibcast6.c##
+ }## 44 ##src/bcast/dgclibcast6.c##
+}## 45 ##src/bcast/dgclibcast6.c##
+
+static void## 46 ##src/bcast/dgclibcast6.c##
+recvfrom_alarm(int signo)## 47 ##src/bcast/dgclibcast6.c##
+{## 48 ##src/bcast/dgclibcast6.c##
+ Write(pipefd[1], "", 1); /* write 1 null byte to pipe */## 49 ##src/bcast/dgclibcast6.c##
+ return;## 50 ##src/bcast/dgclibcast6.c##
+}## 51 ##src/bcast/dgclibcast6.c##
diff --git a/unix/unpv13e/bcast/udpcli01.c b/unix/unpv13e/bcast/udpcli01.c
new file mode 100644
index 0000000..24a3e48
--- /dev/null
+++ b/unix/unpv13e/bcast/udpcli01.c
@@ -0,0 +1,22 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd;
+ struct sockaddr_in servaddr;
+
+ if (argc != 2)
+ err_quit("usage: udpcli01 ");
+
+ bzero(&servaddr, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_port = htons(13); /* standard daytime server */
+ Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
+
+ sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
+
+ dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
+
+ exit(0);
+}
diff --git a/unix/unpv13e/bcast/udpcli02.c b/unix/unpv13e/bcast/udpcli02.c
new file mode 100644
index 0000000..b2d1d75
--- /dev/null
+++ b/unix/unpv13e/bcast/udpcli02.c
@@ -0,0 +1,22 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd;
+ struct sockaddr_in servaddr;
+
+ if (argc != 2)
+ err_quit("usage: udpcli02 ");
+
+ bzero(&servaddr, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_port = htons(13); /* standard daytime server */
+ Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
+
+ sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
+
+ dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
+
+ exit(0);
+}
diff --git a/unix/unpv13e/bcast/udpcli03.c b/unix/unpv13e/bcast/udpcli03.c
new file mode 100644
index 0000000..93d26fd
--- /dev/null
+++ b/unix/unpv13e/bcast/udpcli03.c
@@ -0,0 +1,22 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd;
+ struct sockaddr_in servaddr;
+
+ if (argc != 2)
+ err_quit("usage: udpcli03 ");
+
+ bzero(&servaddr, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_port = htons(13); /* standard daytime server */
+ Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
+
+ sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
+
+ dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
+
+ exit(0);
+}
diff --git a/unix/unpv13e/bcast/udpcli04.c b/unix/unpv13e/bcast/udpcli04.c
new file mode 100644
index 0000000..29dbbee
--- /dev/null
+++ b/unix/unpv13e/bcast/udpcli04.c
@@ -0,0 +1,22 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd;
+ struct sockaddr_in servaddr;
+
+ if (argc != 2)
+ err_quit("usage: udpcli04 ");
+
+ bzero(&servaddr, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_port = htons(13); /* standard daytime server */
+ Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
+
+ sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
+
+ dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
+
+ exit(0);
+}
diff --git a/unix/unpv13e/bcast/udpcli05.c b/unix/unpv13e/bcast/udpcli05.c
new file mode 100644
index 0000000..dd0cad3
--- /dev/null
+++ b/unix/unpv13e/bcast/udpcli05.c
@@ -0,0 +1,22 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd;
+ struct sockaddr_in servaddr;
+
+ if (argc != 2)
+ err_quit("usage: udpcli05 ");
+
+ bzero(&servaddr, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_port = htons(13); /* standard daytime server */
+ Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
+
+ sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
+
+ dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
+
+ exit(0);
+}
diff --git a/unix/unpv13e/bcast/udpcli06.c b/unix/unpv13e/bcast/udpcli06.c
new file mode 100644
index 0000000..b2d1d75
--- /dev/null
+++ b/unix/unpv13e/bcast/udpcli06.c
@@ -0,0 +1,22 @@
+#include "unp.h"
+
+int
+main(int argc, char **argv)
+{
+ int sockfd;
+ struct sockaddr_in servaddr;
+
+ if (argc != 2)
+ err_quit("usage: udpcli02 ");
+
+ bzero(&servaddr, sizeof(servaddr));
+ servaddr.sin_family = AF_INET;
+ servaddr.sin_port = htons(13); /* standard daytime server */
+ Inet_pton(AF_INET, argv[1], &servaddr.sin_addr);
+
+ sockfd = Socket(AF_INET, SOCK_DGRAM, 0);
+
+ dg_cli(stdin, sockfd, (SA *) &servaddr, sizeof(servaddr));
+
+ exit(0);
+}
diff --git a/unix/unpv13e/config.guess b/unix/unpv13e/config.guess
new file mode 100644
index 0000000..ed2e03b
--- /dev/null
+++ b/unix/unpv13e/config.guess
@@ -0,0 +1,1321 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002 Free Software Foundation, Inc.
+
+timestamp='2002-03-20'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Per Bothner .
+# Please send patches to . Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to ."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit 0 ;;
+ --version | -v )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+
+dummy=dummy-$$
+trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script.
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int dummy(){}" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
+ if test $? = 0 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ rm -f $dummy.c $dummy.o $dummy.rel ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ macppc:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvmeppc:OpenBSD:*:*)
+ echo powerpc-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mipseb-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ alpha:OSF1:*:*)
+ if test $UNAME_RELEASE = "V4.0"; then
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ fi
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ cat <$dummy.s
+ .data
+\$Lformat:
+ .byte 37,100,45,37,120,10,0 # "%d-%x\n"
+
+ .text
+ .globl main
+ .align 4
+ .ent main
+main:
+ .frame \$30,16,\$26,0
+ ldgp \$29,0(\$27)
+ .prologue 1
+ .long 0x47e03d80 # implver \$0
+ lda \$2,-1
+ .long 0x47e20c21 # amask \$2,\$1
+ lda \$16,\$Lformat
+ mov \$0,\$17
+ not \$1,\$18
+ jsr \$26,printf
+ ldgp \$29,0(\$26)
+ mov 0,\$16
+ jsr \$26,exit
+ .end main
+EOF
+ eval $set_cc_for_build
+ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ case `./$dummy` in
+ 0-0)
+ UNAME_MACHINE="alpha"
+ ;;
+ 1-0)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 1-1)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 1-101)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 2-303)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ 2-307)
+ UNAME_MACHINE="alphaev67"
+ ;;
+ 2-1307)
+ UNAME_MACHINE="alphaev68"
+ ;;
+ esac
+ fi
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit 0 ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit 0;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit 0 ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit 0 ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit 0;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit 0 ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy \
+ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm -f $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:[45])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include
+ #include
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
+ if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+ rm -f $dummy.c $dummy
+ fi ;;
+ esac
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3D:*:*:*)
+ echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit 0 ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit 0 ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit 0 ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit 0 ;;
+ x86:Interix*:3*)
+ echo i386-pc-interix3
+ exit 0 ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i386-pc-interix
+ exit 0 ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit 0 ;;
+ arm*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mipsel
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+ rm -f $dummy.c
+ test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
+ ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit 0 ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit 0 ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit 0 ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit 0 ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit 0 ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit 0 ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit 0 ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit 0 ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit 0 ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit 0 ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit 0 ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #ifdef __INTEL_COMPILER
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+ rm -f $dummy.c
+ test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+ test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit 0 ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit 0 ;;
+ i*86:*:5:[78]*)
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit 0 ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit 0 ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says
+ echo i586-unisys-sysv4
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes .
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit 0 ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit 0 ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit 0 ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit 0 ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Darwin:*:*)
+ echo `uname -p`-apple-darwin${UNAME_RELEASE}
+ exit 0 ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit 0 ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit 0 ;;
+ NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit 0 ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit 0 ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit 0 ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit 0 ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit 0 ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit 0 ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit 0 ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit 0 ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit 0 ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit 0 ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit 0 ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit 0 ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit 0 ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <
+# include
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
+rm -f $dummy.c $dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+cat >&2 < in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/unix/unpv13e/config.h.in b/unix/unpv13e/config.h.in
new file mode 100644
index 0000000..7bef959
--- /dev/null
+++ b/unix/unpv13e/config.h.in
@@ -0,0 +1,325 @@
+/* config.h.in. Generated from configure.in by autoheader. */
+
+/* CPU, vendor, and operating system */
+#undef CPU_VENDOR_OS
+
+/* Define to 1 if defines struct addrinfo */
+#undef HAVE_ADDRINFO_STRUCT
+
+/* Define to 1 if you have the header file. */
+#undef HAVE_ARPA_INET_H
+
+/* Define to 1 if you have the `bzero' function. */
+#undef HAVE_BZERO
+
+/* Define to 1 if the /dev/streams/xtiso/tcp device exists */
+#undef HAVE_DEV_STREAMS_XTISO_TCP
+
+/* Define to 1 if the /dev/tcp device exists */
+#undef HAVE_DEV_TCP
+
+/* Define to 1 if the /dev/xti/tcp device exists */
+#undef HAVE_DEV_XTI_TCP
+
+/* Define to 1 if you have the header file. */
+#undef HAVE_ERRNO_H
+
+/* Define to 1 if you have the header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `getaddrinfo' function. */
+#undef HAVE_GETADDRINFO
+
+/* define if getaddrinfo prototype is in */
+#undef HAVE_GETADDRINFO_PROTO
+
+/* Define to 1 if you have the `gethostbyname2' function. */
+#undef HAVE_GETHOSTBYNAME2
+
+/* Define to 1 if you have the `gethostbyname_r' function. */
+#undef HAVE_GETHOSTBYNAME_R
+
+/* Define to 1 if you have the `gethostname' function. */
+#undef HAVE_GETHOSTNAME
+
+/* define if gethostname prototype is in */
+#undef HAVE_GETHOSTNAME_PROTO
+
+/* Define to 1 if you have the `getnameinfo' function. */
+#undef HAVE_GETNAMEINFO
+
+/* define if getnameinfo prototype is in */
+#undef HAVE_GETNAMEINFO_PROTO
+
+/* define if getrusage prototype is in */
+#undef HAVE_GETRUSAGE_PROTO
+
+/* Define to 1 if you have the `hstrerror' function. */
+#undef HAVE_HSTRERROR
+
+/* define if hstrerror prototype is in */
+#undef HAVE_HSTRERROR_PROTO
+
+/* Define to 1 if defines struct if_nameindex */
+#undef HAVE_IF_NAMEINDEX_STRUCT
+
+/* Define to 1 if you have the `if_nametoindex' function. */
+#undef HAVE_IF_NAMETOINDEX
+
+/* define if if_nametoindex prototype is in */
+#undef HAVE_IF_NAMETOINDEX_PROTO
+
+/* Define to 1 if you have the `inet6_rth_init' function. */
+#undef HAVE_INET6_RTH_INIT
+
+/* Define to 1 if you have the `inet_aton' function. */
+#undef HAVE_INET_ATON
+
+/* define if inet_aton prototype is in