Suche senden
Hochladen
Printf
•
0 gefällt mir
•
1,059 views
akitsukada
Folgen
コマンドなんでも読書会用資料
Weniger lesen
Mehr lesen
Technologie
Business
Melden
Teilen
Melden
Teilen
1 von 42
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
About Go
About Go
Jongmin Kim
Gophercon 2016 Communicating Sequential Goroutines
Gophercon 2016 Communicating Sequential Goroutines
Adrian Cockcroft
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...
Ari Lerner
เครื่องใช้ไฟฟ้า
เครื่องใช้ไฟฟ้า
thananat
Las emociones y el sentido de la vida
Las emociones y el sentido de la vida
Euler Ruiz
El uso correcto del idioma español en los medios sociales - Fundéu, BBVA-AERCO
El uso correcto del idioma español en los medios sociales - Fundéu, BBVA-AERCO
Carlos Terrones Lizana
Tirocini formativi 15set11
Tirocini formativi 15set11
StudioCarloMussi consulenti del lavoro
Aleph500: importazione dei record da SBN
Aleph500: importazione dei record da SBN
Romina D'Antoni
Empfohlen
About Go
About Go
Jongmin Kim
Gophercon 2016 Communicating Sequential Goroutines
Gophercon 2016 Communicating Sequential Goroutines
Adrian Cockcroft
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...
How to create a 3.2 billion dollar business in 20 minutes: combining AngularJ...
Ari Lerner
เครื่องใช้ไฟฟ้า
เครื่องใช้ไฟฟ้า
thananat
Las emociones y el sentido de la vida
Las emociones y el sentido de la vida
Euler Ruiz
El uso correcto del idioma español en los medios sociales - Fundéu, BBVA-AERCO
El uso correcto del idioma español en los medios sociales - Fundéu, BBVA-AERCO
Carlos Terrones Lizana
Tirocini formativi 15set11
Tirocini formativi 15set11
StudioCarloMussi consulenti del lavoro
Aleph500: importazione dei record da SBN
Aleph500: importazione dei record da SBN
Romina D'Antoni
мастер класс
мастер класс
Юлиана Соловьева
EXAMEN DE COMPUTACION
EXAMEN DE COMPUTACION
julissa bailon
A áfrica dos grandes reinos
A áfrica dos grandes reinos
Íris Ferreira
Potafos cana
Potafos cana
gustavohfs
จินตนาการ[1]..
จินตนาการ[1]..
tutorok
Navegando En El Pasado
Navegando En El Pasado
GIOVANI CASTRO
ALV HC Keramikos 8-sep-2011
ALV HC Keramikos 8-sep-2011
Hockey Club Keramikos
Offerme2 好康通活動平台介紹
Offerme2 好康通活動平台介紹
commandp Inc.
Decreto%20230 2007%20 Ensenanzas%20 Primaria
Decreto%20230 2007%20 Ensenanzas%20 Primaria
Juan Félix García Pérez
20110906オープニングダイアログ
20110906オープニングダイアログ
フリーランス
Didática dinâmica: componente para a aprendizagem ativa
Didática dinâmica: componente para a aprendizagem ativa
Rosária Nakashima
Inside the-browser
Inside the-browser
jy03845581
Prova 7ºanos 1ºbi silvana
Prova 7ºanos 1ºbi silvana
Íris Ferreira
บทที่๘
บทที่๘
ลูกอีสาน อารามบอย
Arte
Arte
Carlos Pastora
مشروع القانون الأساسي للقضاة
مشروع القانون الأساسي للقضاة
Amir Jeddi
Matjames srv gild-2
Matjames srv gild-2
PrincessSkywalker
祝大家 中秋節快樂
祝大家 中秋節快樂
Alice Ying
Gestiones de utilidad publica
Gestiones de utilidad publica
guadalinfosorvilan
Prova 9ºanos 1 bi silvana 2014
Prova 9ºanos 1 bi silvana 2014
Íris Ferreira
Solutions Architect, Exciting Career for Engineers
Solutions Architect, Exciting Career for Engineers
akitsukada
Morning Session - AWS Serverless Ways
Morning Session - AWS Serverless Ways
akitsukada
Weitere ähnliche Inhalte
Andere mochten auch
мастер класс
мастер класс
Юлиана Соловьева
EXAMEN DE COMPUTACION
EXAMEN DE COMPUTACION
julissa bailon
A áfrica dos grandes reinos
A áfrica dos grandes reinos
Íris Ferreira
Potafos cana
Potafos cana
gustavohfs
จินตนาการ[1]..
จินตนาการ[1]..
tutorok
Navegando En El Pasado
Navegando En El Pasado
GIOVANI CASTRO
ALV HC Keramikos 8-sep-2011
ALV HC Keramikos 8-sep-2011
Hockey Club Keramikos
Offerme2 好康通活動平台介紹
Offerme2 好康通活動平台介紹
commandp Inc.
Decreto%20230 2007%20 Ensenanzas%20 Primaria
Decreto%20230 2007%20 Ensenanzas%20 Primaria
Juan Félix García Pérez
20110906オープニングダイアログ
20110906オープニングダイアログ
フリーランス
Didática dinâmica: componente para a aprendizagem ativa
Didática dinâmica: componente para a aprendizagem ativa
Rosária Nakashima
Inside the-browser
Inside the-browser
jy03845581
Prova 7ºanos 1ºbi silvana
Prova 7ºanos 1ºbi silvana
Íris Ferreira
บทที่๘
บทที่๘
ลูกอีสาน อารามบอย
Arte
Arte
Carlos Pastora
مشروع القانون الأساسي للقضاة
مشروع القانون الأساسي للقضاة
Amir Jeddi
Matjames srv gild-2
Matjames srv gild-2
PrincessSkywalker
祝大家 中秋節快樂
祝大家 中秋節快樂
Alice Ying
Gestiones de utilidad publica
Gestiones de utilidad publica
guadalinfosorvilan
Prova 9ºanos 1 bi silvana 2014
Prova 9ºanos 1 bi silvana 2014
Íris Ferreira
Andere mochten auch
(20)
мастер класс
мастер класс
EXAMEN DE COMPUTACION
EXAMEN DE COMPUTACION
A áfrica dos grandes reinos
A áfrica dos grandes reinos
Potafos cana
Potafos cana
จินตนาการ[1]..
จินตนาการ[1]..
Navegando En El Pasado
Navegando En El Pasado
ALV HC Keramikos 8-sep-2011
ALV HC Keramikos 8-sep-2011
Offerme2 好康通活動平台介紹
Offerme2 好康通活動平台介紹
Decreto%20230 2007%20 Ensenanzas%20 Primaria
Decreto%20230 2007%20 Ensenanzas%20 Primaria
20110906オープニングダイアログ
20110906オープニングダイアログ
Didática dinâmica: componente para a aprendizagem ativa
Didática dinâmica: componente para a aprendizagem ativa
Inside the-browser
Inside the-browser
Prova 7ºanos 1ºbi silvana
Prova 7ºanos 1ºbi silvana
บทที่๘
บทที่๘
Arte
Arte
مشروع القانون الأساسي للقضاة
مشروع القانون الأساسي للقضاة
Matjames srv gild-2
Matjames srv gild-2
祝大家 中秋節快樂
祝大家 中秋節快樂
Gestiones de utilidad publica
Gestiones de utilidad publica
Prova 9ºanos 1 bi silvana 2014
Prova 9ºanos 1 bi silvana 2014
Mehr von akitsukada
Solutions Architect, Exciting Career for Engineers
Solutions Architect, Exciting Career for Engineers
akitsukada
Morning Session - AWS Serverless Ways
Morning Session - AWS Serverless Ways
akitsukada
AWS Introduction for Startups
AWS Introduction for Startups
akitsukada
Real-time Chat Backend on AWS IoT 20160422
Real-time Chat Backend on AWS IoT 20160422
akitsukada
Amazon Cognito Deep Dive @ JAWS DAYS 2016
Amazon Cognito Deep Dive @ JAWS DAYS 2016
akitsukada
AWS Mobile Maniacs
AWS Mobile Maniacs
akitsukada
My Startup Learnings (短縮版)
My Startup Learnings (短縮版)
akitsukada
CTO Night & Day Morning Session "スタートアップCTOならおさえておきたいAWS基本構成"
CTO Night & Day Morning Session "スタートアップCTOならおさえておきたいAWS基本構成"
akitsukada
CTO Night & Day Morning Session "Auto Scaling & Spot Instances Deep Dive"
CTO Night & Day Morning Session "Auto Scaling & Spot Instances Deep Dive"
akitsukada
AWS for Startups 2016 (2015/12/02版)
AWS for Startups 2016 (2015/12/02版)
akitsukada
Awsjpcasestudies
Awsjpcasestudies
akitsukada
Mobile Hubで変わる、アプリ開発最前線
Mobile Hubで変わる、アプリ開発最前線
akitsukada
Auto Scaling x Spot Instances によるスケーラビリティと コストカット
Auto Scaling x Spot Instances によるスケーラビリティと コストカット
akitsukada
20140807 AWS Startup Tech Meetup
20140807 AWS Startup Tech Meetup
akitsukada
Little tips ios
Little tips ios
akitsukada
データベース・リファクタリング読書会第四回オープニング
データベース・リファクタリング読書会第四回オープニング
akitsukada
みゆっき☆Think#10 チーム開発〜脱ぼっちマインド〜
みゆっき☆Think#10 チーム開発〜脱ぼっちマインド〜
akitsukada
With git
With git
akitsukada
Find(ラスト)
Find(ラスト)
akitsukada
Find(1)
Find(1)
akitsukada
Mehr von akitsukada
(20)
Solutions Architect, Exciting Career for Engineers
Solutions Architect, Exciting Career for Engineers
Morning Session - AWS Serverless Ways
Morning Session - AWS Serverless Ways
AWS Introduction for Startups
AWS Introduction for Startups
Real-time Chat Backend on AWS IoT 20160422
Real-time Chat Backend on AWS IoT 20160422
Amazon Cognito Deep Dive @ JAWS DAYS 2016
Amazon Cognito Deep Dive @ JAWS DAYS 2016
AWS Mobile Maniacs
AWS Mobile Maniacs
My Startup Learnings (短縮版)
My Startup Learnings (短縮版)
CTO Night & Day Morning Session "スタートアップCTOならおさえておきたいAWS基本構成"
CTO Night & Day Morning Session "スタートアップCTOならおさえておきたいAWS基本構成"
CTO Night & Day Morning Session "Auto Scaling & Spot Instances Deep Dive"
CTO Night & Day Morning Session "Auto Scaling & Spot Instances Deep Dive"
AWS for Startups 2016 (2015/12/02版)
AWS for Startups 2016 (2015/12/02版)
Awsjpcasestudies
Awsjpcasestudies
Mobile Hubで変わる、アプリ開発最前線
Mobile Hubで変わる、アプリ開発最前線
Auto Scaling x Spot Instances によるスケーラビリティと コストカット
Auto Scaling x Spot Instances によるスケーラビリティと コストカット
20140807 AWS Startup Tech Meetup
20140807 AWS Startup Tech Meetup
Little tips ios
Little tips ios
データベース・リファクタリング読書会第四回オープニング
データベース・リファクタリング読書会第四回オープニング
みゆっき☆Think#10 チーム開発〜脱ぼっちマインド〜
みゆっき☆Think#10 チーム開発〜脱ぼっちマインド〜
With git
With git
Find(ラスト)
Find(ラスト)
Find(1)
Find(1)
Kürzlich hochgeladen
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ThousandEyes
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Radu Cotescu
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
RTylerCroy
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ThousandEyes
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Principled Technologies
How to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
naman860154
Evaluating the top large language models.pdf
Evaluating the top large language models.pdf
ChristopherTHyatt
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Delhi Call girls
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Delhi Call girls
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Igalia
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Product Anonymous
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
debabhi2
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
sudhanshuwaghmare1
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
Antenna Manufacturer Coco
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
UK Journal
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Safe Software
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Enterprise Knowledge
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
The Digital Insurer
Kürzlich hochgeladen
(20)
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
How to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
Evaluating the top large language models.pdf
Evaluating the top large language models.pdf
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Printf
1.
2.
3.
4.
5.
6.
7.
8.
9.
$ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 [abcde] [1.03] [%]
10.
$ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 [abcde] [1.03] [%] [ abcde ]n[ 1.03 ]n[ % ]n [ ... L151 fwrite(start, 1, fmt - start, stdout); abcde ... L289 PF(start, p); => L87 (void)fputs(b, stdout); ]n[ ... L151 fwrite(start, 1, fmt - start, stdout); 1.03 ... L318 PF(start, p); => L87 (void)fputs(b, stdout); ]n[ ... L151 fwrite(start, 1, fmt - start, stdout); %% ... L154 putchar('%'); ]n ... L151 fwrite(start, 1, fmt - start, stdout);
11.
$ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 143 fmt = format = *argv; 144 chopped = escape(fmt, 1, &len); /* backslash interpretation */ 145 rval = end = 0; 146 gargv = ++argv; 147 for (;;) { 148 start = fmt; 149 while (fmt < format + len) { 150 if (fmt[0] == '%') { 151 fwrite(start, 1, fmt - start, stdout); 152 if (fmt[1] == '%') { 153 /* %% prints a % */ 154 putchar('%'); 155 fmt += 2; 156 } else { 157 fmt = doformat(fmt, &rval); 158 if (fmt == NULL) 159 return (1); 160 end = 0; 161 } 162 start = fmt; 163 } else 164 fmt++; 165 } 166 167 if (end == 1) { 168 warnx1("missing format character", NULL, NULL); 169 return (1); 170 } 171 fwrite(start, 1, fmt - start, stdout); 172 if (chopped || !*gargv) 173 return (rval); 174 /* Restart at the beginning of the format string. */ 175 fmt = format; 176 end = 1; 177 } 178 /* NOTREACHED */
12.
$ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 143 fmt = format = *argv; 144 chopped = escape(fmt, 1, &len); /* backslash interpretation */ 145 rval = end = 0; 146 gargv = ++argv; 147 for (;;) { 148 start = fmt; 149 while (fmt < format + len) { 150 if (fmt[0] == '%') { 151 fwrite(start, 1, fmt - start, stdout); 152 if (fmt[1] == '%') { 153 /* %% prints a % */ 154 putchar('%'); 155 fmt += 2; 156 } else { 157 fmt = doformat(fmt, &rval); 158 if (fmt == NULL) 159 return (1); 160 end = 0; 161 } 162 start = fmt; 163 } else 164 fmt++; 165 } 166 167 if (end == 1) { 168 warnx1("missing format character", NULL, NULL); 169 return (1); 170 } 171 fwrite(start, 1, fmt - start, stdout); 172 if (chopped || !*gargv) 173 return (rval); 174 /* Restart at the beginning of the format string. */ 175 fmt = format; 176 end = 1; 177 } 178 /* NOTREACHED */
13.
$ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 143 fmt = format = *argv; 144 chopped = escape(fmt, 1, &len); /* backslash interpretation */ 145 rval = end = 0; 146 gargv = ++argv; 147 for (;;) { 148 start = fmt; 149 while (fmt < format + len) { 150 if (fmt[0] == '%') { 151 fwrite(start, 1, fmt - start, stdout); 152 if (fmt[1] == '%') { 153 154 /* %% prints a % */ putchar('%'); [%s]n[%2.2f]n[%%]n 155 fmt += 2; 156 } else { 157 158 fmt = doformat(fmt, &rval); if (fmt == NULL) 21 159 return (1); 160 end = 0; 161 } 162 start = fmt; 163 } else [%s]n 164 fmt++; 165 } [%2.2f]n 166 167 if (end == 1) { [%%]n 168 warnx1("missing format character", NULL, NULL); 169 return (1); 170 } 171 fwrite(start, 1, fmt - start, stdout); 172 if (chopped || !*gargv) 173 return (rval); 18 174 /* Restart at the beginning of the format string. */ 175 fmt = format; 176 end = 1; 177 } 178 /* NOTREACHED */
14.
$ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 143 fmt = format = *argv; 144 chopped = escape(fmt, 1, &len); /* backslash interpretation */ 145 rval = end = 0; 146 gargv = ++argv; 147 for (;;) { 148 start = fmt; static char **gargv; 149 while (fmt < format + len) { 150 if (fmt[0] == '%') { 151 fwrite(start, 1, fmt - start, stdout); 152 if (fmt[1] == '%') { 153 /* %% prints a % */ 154 putchar('%'); “abcde” 155 fmt += 2; 156 } else { 157 fmt = doformat(fmt, &rval); 158 if (fmt == NULL) 159 return (1); 160 end = 0; 161 } 162 start = fmt; 163 } else 164 fmt++; 165 } 166 167 if (end == 1) { 168 warnx1("missing format character", NULL, NULL); 169 return (1); 170 } 171 fwrite(start, 1, fmt - start, stdout); 172 if (chopped || !*gargv) 173 return (rval); 174 /* Restart at the beginning of the format string. */ 175 fmt = format; 176 end = 1; 177 } 178 /* NOTREACHED */
15.
$ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 143 fmt = format = *argv; 144 chopped = escape(fmt, 1, &len); /* backslash interpretation */ 145 rval = end = 0; 146 gargv = ++argv; 147 for (;;) { 148 start = fmt; 149 while (fmt < format + len) { 150 if (fmt[0] == '%') { 151 fwrite(start, 1, fmt - start, stdout); 152 if (fmt[1] == '%') { 153 /* %% prints a % */ 154 putchar('%'); 155 fmt += 2; 156 } else { 157 fmt = doformat(fmt, &rval); 158 if (fmt == NULL) 159 return (1); 160 end = 0; 161 } 162 start = fmt; 163 } else 164 fmt++; 165 } 166 167 if (end == 1) { 168 warnx1("missing format character", NULL, NULL); 169 return (1); 170 } 171 fwrite(start, 1, fmt - start, stdout); 172 if (chopped || !*gargv) 173 return (rval); 174 /* Restart at the beginning of the format string. */ 175 fmt = format; 176 end = 1; 177 } 178 /* NOTREACHED */
16.
$ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 143 fmt = format = *argv; 144 chopped = escape(fmt, 1, &len); /* backslash interpretation */ 145 rval = end = 0; 146 gargv = ++argv; 147 for (;;) { 148 start = fmt; 149 while (fmt < format + len) { 150 if (fmt[0] == '%') { 151 fwrite(start, 1, fmt - start, stdout); 152 if (fmt[1] == '%') { 153 /* %% prints a % */ 154 putchar('%'); 155 fmt += 2; 156 } else { 157 fmt = doformat(fmt, &rval); 158 if (fmt == NULL) 159 160 return (1); end = 0; start:char * 161 162 } start = fmt; [%s]n[%2.2f]n[%%]n 163 } else 164 fmt++; 165 } fmt:char * 166 167 if (end == 1) { [%s]n[%2.2f]n[%%]n 168 warnx1("missing format character", NULL, NULL); 169 return (1); 170 } 171 fwrite(start, 1, fmt - start, stdout); 172 if (chopped || !*gargv) 173 return (rval); 174 /* Restart at the beginning of the format string. */ 175 fmt = format; 176 end = 1; 177 } 178 /* NOTREACHED */
17.
[ $ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 143 fmt = format = *argv; 144 chopped = escape(fmt, 1, &len); /* backslash interpretation */ 145 rval = end = 0; 146 gargv = ++argv; 147 for (;;) { 148 start = fmt; 149 while (fmt < format + len) { start:char * 150 if (fmt[0] == '%') { 151 fwrite(start, 1, fmt - start, stdout); [%s]n[%2.2f]n[%%]n 152 if (fmt[1] == '%') { 153 /* %% prints a % */ 154 putchar('%'); 155 fmt += 2; 156 157 } else { fmt = doformat(fmt, &rval); fmt:char * 158 if (fmt == NULL) [%s]n[%2.2f]n[%%]n 159 return (1); 160 end = 0; 161 } 162 start = fmt; fmt - start == 1 163 } else 164 fmt++; 165 } 166 fwrite( 167 if (end == 1) { 168 warnx1("missing format character", NULL, NULL); “[%s]n[%2.2f]n[%%]n”, 169 170 } return (1); 1, 1, stdout 171 172 fwrite(start, 1, fmt - start, stdout); if (chopped || !*gargv) ); 173 return (rval); 174 /* Restart at the beginning of the format string. */ 175 fmt = format; => “[“ 176 end = 1; 177 } 178 /* NOTREACHED */
18.
[ $ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 143 fmt = format = *argv; 144 chopped = escape(fmt, 1, &len); /* backslash interpretation */ 145 rval = end = 0; 146 gargv = ++argv; 147 for (;;) { fmt:char * 148 start = fmt; 149 while (fmt < format + len) { [%s]n[%2.2f]n[%%]n 150 if (fmt[0] == '%') { 151 fwrite(start, 1, fmt - start, stdout); 152 if (fmt[1] == '%') { 153 /* %% prints a % */ L157 154 putchar('%'); 155 fmt += 2; fmt = doformat( 156 } else { 157 fmt = doformat(fmt, &rval); fmt, &rval 158 if (fmt == NULL) 159 return (1); ); 160 end = 0; 161 } 162 start = fmt; 163 } else 164 fmt++; 165 } 166 167 if (end == 1) { 168 warnx1("missing format character", NULL, NULL); 169 return (1); 170 } 171 fwrite(start, 1, fmt - start, stdout); 172 if (chopped || !*gargv) 173 return (rval); 174 /* Restart at the beginning of the format string. */ 175 fmt = format; 176 end = 1; 177 } 178 /* NOTREACHED */
19.
[ $ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 182 static char * 183 doformat(char *start, int *rval) 184 { 185 static const char skip1[] = "#'-+ 0"; 186 static const char skip2[] = "0123456789"; %hogehoge 191 fmt = start + 1; 192 /* skip to field width */ 193 fmt += strspn(fmt, skip1); 194 if (*fmt == '*') { 195 if (getint(&fieldwidth)) 196 return (NULL); 197 havewidth = 1; 198 ++fmt; 199 } else { 200 havewidth = 0; 201 202 /* skip to possible '.', get following precision */ 203 fmt += strspn(fmt, skip2); 204 } 205 if (*fmt == '.') { 206 /* precision present? */ 207 ++fmt; 208 if (*fmt == '*') { 209 if (getint(&precision)) 210 return (NULL); 211 haveprec = 1; 212 ++fmt; 213 } else { 214 haveprec = 0; 215 216 /* skip to conversion char */ 217 fmt += strspn(fmt, skip2); 218 } 219 } else 220 haveprec = 0;
20.
[ $ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 182 static char * 183 doformat(char *start, int *rval) 184 { 185 static const char skip1[] = "#'-+ 0"; 186 static const char skip2[] = "0123456789"; 191 fmt = start + 1; 192 /* skip to field width */ start:char * 193 fmt += strspn(fmt, skip1); 194 if (*fmt == '*') { [%s]n[%2.2f]n[%%]n 195 if (getint(&fieldwidth)) 196 return (NULL); 197 havewidth = 1; 198 ++fmt; fmt:char * 199 200 } else { havewidth = 0; [%s]n[%2.2f]n[%%]n 201 202 /* skip to possible '.', get following precision */ 203 fmt += strspn(fmt, skip2); 204 } 205 if (*fmt == '.') { 206 /* precision present? */ 207 ++fmt; 208 if (*fmt == '*') { 209 if (getint(&precision)) 210 return (NULL); 211 haveprec = 1; 212 ++fmt; 213 } else { 214 haveprec = 0; 215 216 /* skip to conversion char */ 217 fmt += strspn(fmt, skip2); 218 } 219 } else 220 haveprec = 0;
21.
[ $ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 182 static char * 183 doformat(char *start, int *rval) 184 { convch:char == ‘s’ 247 convch = *fmt; 248 nextch = *++fmt; nextch:char == ‘]’ 249 *fmt = '0'; 250 switch (convch) { 251 case 'b': { fmt:char * 252 size_t len; 253 char *p; [%s0n[%2.2f]n[%%]n 254 int getout; 255 285 case 's': { start:char * 286 287 const char *p; [%s0n[%2.2f]n[%%]n 288 p = getstr(); 289 PF(start, p); 290 break; 291 }
22.
[ $ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 182 static char * 183 doformat(char *start, int *rval) 184 { 247 convch = *fmt; 248 nextch = *++fmt; 249 *fmt = '0'; 250 switch (convch) { 251 case 'b': { 252 size_t len; 253 char *p; 254 int getout; 255 285 case 's': { 286 const char *p; 287 288 p = getstr(); 289 PF(start, p); 290 break; 291 } 442 static const char * 443 getstr(void) 444 { 445 if (!*gargv) 446 return (""); 447 return (*gargv++); 448 }
23.
[abcde $ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 182 static char * 183 doformat(char *start, int *rval) 184 { 247 convch = *fmt; 248 nextch = *++fmt; 249 *fmt = '0'; 250 251 switch (convch) { case 'b': { [%s0n[%2.2f]n[%%]n 252 size_t len; 253 char *p; 254 int getout; 255 285 case 's': { 286 const char *p; 287 “abcde” 288 p = getstr(); 289 PF(start, p); 290 break; 75 #define PF(f, func) do { 291 } 76 char *b = NULL; 77 if (havewidth) 78 if (haveprec) 79 (void)asprintf(&b, f, fieldwidth, precision, func); 80 else 81 (void)asprintf(&b, f, fieldwidth, func); 82 else if (haveprec) 83 (void)asprintf(&b, f, precision, func); 84 else 85 (void)asprintf(&b, f, func); 86 if (b) { 87 88 (void)fputs(b, stdout); free(b); [abcde 89 } 90 } while (0)
24.
[abcde $ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 182 static char * 183 doformat(char *start, int *rval) 184 { nextch:char == ‘]’ 285 case 's': { 286 const char *p; 287 288 p = getstr(); fmt:char * 289 PF(start, p); 290 break; [%s0n[%2.2f]n[%%]n 291 } ! ! ! 330 *fmt = nextch; 331 return (fmt); [%s]n[%2.2f]n[%%]n 332 } 157 fmt = doformat(fmt, &rval); 158 if (fmt == NULL) 159 return (1); [%s]n[%2.2f]n[%%]n 160 end = 0; 161 } 162 start = fmt; ! ! ! ! fmt:char * [%s]n[%2.2f]n[%%]n start:char * [%s]n[%2.2f]n[%%]n
25.
[abcde]
[ $ printf "[%s]n[%2.2f]n[%%]n" abcde 1.034 149 while (fmt < format + len) { 150 if (fmt[0] == '%') { 151 fwrite(start, 1, fmt - start, stdout); 152 if (fmt[1] == '%') { 153 /* %% prints a % */ fmt:char * 154 155 putchar('%'); fmt += 2; [%s]n[%2.2f]n[%%]n 156 } else { 157 fmt = doformat(fmt, &rval); 158 159 if (fmt == NULL) return (1); start:char * 160 end = 0; [%s]n[%2.2f]n[%%]n 161 } 162 start = fmt; 163 } else 164 fmt++; fwrite( 165 } start, // ]n[%2... 1, // 1 fmt - start, // 3 stdout ); => “]n[“
26.
[abcde]
[ $ printf "[%s]n[%2.2f]n[%%]n" abcde 1.034 143 fmt = format = *argv; 144 chopped = escape(fmt, 1, &len); /* backslash interpretation */ 145 rval = end = 0; 146 gargv = ++argv; 147 for (;;) { fmt:char * 148 start = fmt; 149 while (fmt < format + len) { [%s]n[%2.2f]n[%%]n 150 if (fmt[0] == '%') { 151 fwrite(start, 1, fmt - start, stdout); 152 if (fmt[1] == '%') { 153 /* %% prints a % */ L157 154 putchar('%'); 155 fmt += 2; fmt = doformat( 156 } else { 157 fmt = doformat(fmt, &rval); fmt, &rval 158 if (fmt == NULL) 159 return (1); ); 160 end = 0; 161 } 162 start = fmt; 163 } else 164 fmt++; 165 } 166 167 if (end == 1) { 168 warnx1("missing format character", NULL, NULL); 169 return (1); 170 } 171 fwrite(start, 1, fmt - start, stdout); 172 if (chopped || !*gargv) 173 return (rval); 174 /* Restart at the beginning of the format string. */ 175 fmt = format; 176 end = 1; 177 } 178 /* NOTREACHED */
27.
[abcde]
[ $ printf "[%s]n[%2.2f]n[%%]n" abcde 1.034 182 static char * 183 doformat(char *start, int *rval) start:char * 184 { 185 static const char skip1[] = "#'-+ 0"; [%s]n[%2.2f]n[%%]n 186 static const char skip2[] = "0123456789"; 191 fmt = start + 1; 192 /* skip to field width */ fmt:char * 193 194 fmt += strspn(fmt, skip1); if (*fmt == '*') { [%s]n[%2.2f]n[%%]n 195 if (getint(&fieldwidth)) 196 return (NULL); 197 havewidth = 1; 198 ++fmt; 199 } else { 200 havewidth = 0; 201 202 /* skip to possible '.', get following precision */ 203 fmt += strspn(fmt, skip2); 204 } 205 if (*fmt == '.') { 206 /* precision present? */ 207 ++fmt; 208 if (*fmt == '*') { 209 if (getint(&precision)) 210 return (NULL); 211 haveprec = 1; 212 ++fmt; 213 } else { 214 haveprec = 0; 215 216 /* skip to conversion char */ 217 fmt += strspn(fmt, skip2); 218 } 219 } else 220 haveprec = 0;
28.
[abcde]
[ $ printf "[%s]n[%2.2f]n[%%]n" abcde 1.034 182 static char * 183 doformat(char *start, int *rval) 184 { 185 static const char skip1[] = "#'-+ 0"; fmt:char * 186 static const char skip2[] = "0123456789"; [%s]n[%2.2f]n[%%]n 191 fmt = start + 1; 192 /* skip to field width */ 193 fmt += strspn(fmt, skip1); 194 if (*fmt == '*') { 195 if (getint(&fieldwidth)) skip1 [#’-+ 0] 196 return (NULL); 197 havewidth = 1; 198 ++fmt; 199 } else { 200 havewidth = 0; 201 202 /* skip to possible '.', get following precision */ 203 fmt += strspn(fmt, skip2); 204 } 205 if (*fmt == '.') { 206 /* precision present? */ 207 ++fmt; 208 if (*fmt == '*') { 209 if (getint(&precision)) 210 return (NULL); 211 haveprec = 1; 212 ++fmt; 213 } else { 214 haveprec = 0; 215 216 /* skip to conversion char */ 217 fmt += strspn(fmt, skip2); 218 } 219 } else 220 haveprec = 0;
29.
[abcde]
[ $ printf "[%s]n[%2.2f]n[%%]n" abcde 1.034 182 static char * 183 doformat(char *start, int *rval) 184 { 185 static const char skip1[] = "#'-+ 0"; 186 static const char skip2[] = "0123456789"; 191 fmt = start + 1; fmt:char* 192 /* skip to field width */ 193 fmt += strspn(fmt, skip1); [%s]n[%2.2f]n[%%]n 194 if (*fmt == '*') { 195 if (getint(&fieldwidth)) 196 return (NULL); 197 havewidth = 1; 198 ++fmt; 199 } else { 200 havewidth = 0; 201 202 /* skip to possible '.', get following precision */ 203 fmt += strspn(fmt, skip2); 204 } 205 if (*fmt == '.') { 206 /* precision present? */ 207 ++fmt; 208 if (*fmt == '*') { fmt:char* 209 if (getint(&precision)) 210 return (NULL); [%s]n[%2.2f]n[%%]n 211 haveprec = 1; 212 ++fmt; 213 } else { 214 haveprec = 0; 215 216 /* skip to conversion char */ 217 fmt += strspn(fmt, skip2); 218 } 219 } else 220 haveprec = 0;
30.
[abcde]
[ $ printf "[%s]n[%2.2f]n[%%]n" abcde 1.034 182 static char * 183 doformat(char *start, int *rval) 184 { 185 static const char skip1[] = "#'-+ 0"; 186 static const char skip2[] = "0123456789"; 191 fmt = start + 1; 192 /* skip to field width */ 193 fmt += strspn(fmt, skip1); 194 if (*fmt == '*') { 195 if (getint(&fieldwidth)) 196 return (NULL); 197 198 havewidth = 1; ++fmt; fmt:char* 199 200 } else { havewidth = 0; [%s]n[%2.2f]n[%%]n 201 202 /* skip to possible '.', get following precision */ 203 fmt += strspn(fmt, skip2); 204 } 205 if (*fmt == '.') { 206 /* precision present? */ 207 ++fmt; 208 209 if (*fmt == '*') { if (getint(&precision)) fmt:char* 210 return (NULL); [%s]n[%2.2f]n[%%]n 211 haveprec = 1; 212 ++fmt; 213 } else { 214 haveprec = 0; 215 216 217 /* skip to conversion char */ fmt += strspn(fmt, skip2); fmt:start* 218 } [%s]n[%2.2f]n[%%]n 219 } else 220 haveprec = 0;
31.
[abcde]
[ $ printf "[%s]n[%2.2f]n[%%]n" abcde 1.034 182 static char * 183 doformat(char *start, int *rval) 184 { 185 static const char skip1[] = "#'-+ 0"; 186 static const char skip2[] = "0123456789"; 191 fmt = start + 1; 192 /* skip to field width */ 193 fmt += strspn(fmt, skip1); 194 if (*fmt == '*') { 195 if (getint(&fieldwidth)) 196 return (NULL); 197 havewidth = 1; 198 ++fmt; 199 } else { 200 havewidth = 0; 201 202 /* skip to possible '.', get following precision */ 203 fmt += strspn(fmt, skip2); fmt:char* 204 } 205 if (*fmt == '.') { [%s]n[%2.2f]n[%%]n 206 /* precision present? */ 207 ++fmt; 208 if (*fmt == '*') { 209 if (getint(&precision)) 210 return (NULL); 211 haveprec = 1; 212 ++fmt; 213 214 } else { haveprec = 0; fmt:char* 215 216 /* skip to conversion char */ [%s]n[%2.2f]n[%%]n 217 fmt += strspn(fmt, skip2); 218 } 219 } else 220 haveprec = 0;
32.
[abcde]
[ $ printf "[%s]n[%2.2f]n[%%]n" abcde 1.034 182 static char * 183 doformat(char *start, int *rval) 184 { convch:char == ‘f’ 247 convch = *fmt; 248 nextch = *++fmt; nextch:char == ‘]’ 249 *fmt = '0'; 250 switch (convch) { 251 case 'b': { fmt:char * 252 size_t len; 253 char *p; [%s]n[%2.2f0n[%%]n 254 int getout; 255 285 case 's': { start:char * 286 287 const char *p; [%s0n[%2.2f0n[%%]n 288 p = getstr(); 289 PF(start, p); 290 break; 291 }
33.
[abcde]
[ $ printf "[%s]n[%2.2f]n[%%]n" abcde 1.034 182 static char * 183 doformat(char *start, int *rval) 184 { 247 convch = *fmt; 248 nextch = *++fmt; 249 *fmt = '0'; 250 switch (convch) { 251 case 'b': { 252 size_t len; 253 char *p; 254 int getout; 255 309 case 'e': case 'E': 310 case 'f': case 'F': 311 case 'g': case 'G': 312 case 'a': case 'A': { 313 long double p; 314 315 if (getfloating(&p, mod_ldbl)) 316 *rval = 1; 317 if (mod_ldbl) 318 PF(start, p); 319 else 320 PF(start, (double)p); 321 break; 507 static int 322 } 508 getfloating(long double *dp, int mod_ldbl) 509 { 510 char *ep; 511 int rval; 512 526 *dp = strtod(*gargv, &ep);
34.
[abcde]
[1.03 $ printf "[%s]n[%2.2f]n[%%]n" abcde 1.034 182 static char * 183 doformat(char *start, int *rval) 184 { 247 convch = *fmt; 248 nextch = *++fmt; 249 *fmt = '0'; [%s]n[%2.2f0n[%%]n 250 switch (convch) { 251 case 'b': { 252 size_t len; 253 char *p; 254 int getout; 255 309 310 case case 'e': case 'E': 'f': case 'F': 1.034 311 case 'g': case 'G': 312 case 'a': case 'A': { 313 long double p; 75 #define PF(f, func) do { 314 76 char *b = NULL; 315 if (getfloating(&p, mod_ldbl)) 77 if (havewidth) 316 *rval = 1; 78 if (haveprec) 317 if (mod_ldbl) 79 (void)asprintf(&b, f, fieldwidth, precision, func); 318 PF(start, p); 80 else 319 else 81 (void)asprintf(&b, f, fieldwidth, func); 320 PF(start, (double)p); 82 else if (haveprec) 321 break; 83 (void)asprintf(&b, f, precision, func); 322 } 84 else 85 (void)asprintf(&b, f, func); 86 if (b) { 87 (void)fputs(b, stdout); 88 free(b); 89 } 90 } while (0)
35.
[abcde]
[1.03 $ printf "[%s]n[%2.2f]n[%%]n" abcdf 1.034 182 static char * 183 doformat(char *start, int *rval) 184 { nextch:char == ‘]’ 309 case 'e': case 'E': 310 case 'f': case 'F': 311 case 'g': case 'G': 312 case 'a': case 'A': { fmt:char * 313 long double p; 314 [%s]n[%2.2f0n[%%]n 315 if (getfloating(&p, mod_ldbl)) 316 *rval = 1; ! ! ! 317 if (mod_ldbl) 318 PF(start, p); [%s]n[%2.2f]n[%%]n 319 else 320 PF(start, (double)p); 321 break; 322 } 330 *fmt = nextch; 331 return (fmt); [%s]n[%2.2f]n[%%]n 332 } 157 158 fmt = doformat(fmt, &rval); if (fmt == NULL) ! ! ! ! 159 return (1); 160 end = 0; 161 } 162 start = fmt; fmt:char * [%s]n[%2.2f]n[%%]n start:char * [%s]n[%2.2f]n[%%]n
36.
[abcde]
[1.03] [ $ printf "[%s]n[%2.2f]n[%%]n" abcde 1.034 149 while (fmt < format + len) { 150 if (fmt[0] == '%') { 151 fwrite(start, 1, fmt - start, stdout); 152 if (fmt[1] == '%') { 153 /* %% prints a % */ fmt:char * 154 155 putchar('%'); fmt += 2; [%s]n[%2.2f]n[%%]n 156 } else { 157 fmt = doformat(fmt, &rval); 158 159 if (fmt == NULL) return (1); fm 160 end = 0; [%s]n[%2.2f]n[%%]n 161 } 162 start = fmt; 163 } else 164 fmt++; fwrite( 165 } start, // ]n[%%... 1, // 1 fmt - start, // 3 stdout ); => “]n[“
37.
[abcde]
[1.03] [% $ printf "[%s]n[%2.2f]n[%%]n" abcde 1.034 149 while (fmt < format + len) { 150 if (fmt[0] == '%') { 151 fwrite(start, 1, fmt - start, stdout); 152 if (fmt[1] == '%') { 153 /* %% prints a % */ 154 putchar('%'); 155 fmt += 2; 156 } else { 157 fmt = doformat(fmt, &rval); fmt:char * 158 if (fmt == NULL) 159 return (1); [%s]n[%2.2f]n[%%]n 160 end = 0; 161 } 162 163 start = fmt; } else start:char * 164 165 } fmt++; [%s]n[%2.2f]n[%%]n
38.
[abcde]
[1.03] [%] $ printf "[%s]n[%2.2f]n[%%]n" abcde 1.034 149 while (fmt < format + len) { 150 if (fmt[0] == '%') { 151 fwrite(start, 1, fmt - start, stdout); 152 if (fmt[1] == '%') { 153 /* %% prints a % */ 154 putchar('%'); 155 fmt += 2; 156 } else { 157 fmt = doformat(fmt, &rval); fmt:char * 158 if (fmt == NULL) 159 return (1); [%s]n[%2.2f]n[%%]n? 160 end = 0; 161 } 162 163 start = fmt; } else start:char * 164 165 } fmt++; [%s]n[%2.2f]n[%%]n 171 fwrite(start, 1, fmt - start, stdout); 172 if (chopped || !*gargv) 173 return (rval);
39.
[abcde]
[1.03] [%] $ printf "[%s]n[%2.2f]n[%%]n" abcde 1.034 149 while (fmt < format + len) { 150 if (fmt[0] == '%') { 151 fwrite(start, 1, fmt - start, stdout); 152 if (fmt[1] == '%') { 153 /* %% prints a % */ 154 putchar('%'); 155 fmt += 2; 156 } else { 157 fmt = doformat(fmt, &rval); 158 if (fmt == NULL) 159 return (1); 160 end = 0; 161 } 162 start = fmt; 163 } else 164 fmt++; 165 } 0 171 fwrite(start, 1, fmt - start, stdout); 172 if (chopped || !*gargv) 173 return (rval);
40.
$ printf "[%s]n[%2.2f]n[%%]n"
abcde 1.034 147 for (;;) { 148 start = fmt; 174 /* Restart at the beginning of the format string. */ 175 fmt = format; 176 end = 1; 177 } $ printf "[%s]n[%2.2f]n[%%]n" abcde 1.034 fghij 23.4 [abcde] 1.03 [fghij] 23.40
41.
177
} 178 /* NOTREACHED */ 179 }
Jetzt herunterladen